flekschas / regl-scatterplot

Scalable WebGL-based scatter plot library build with Regl
https://flekschas.github.io/regl-scatterplot/
MIT License
184 stars 21 forks source link

feat: density-based point size #143

Open flekschas opened 1 year ago

flekschas commented 1 year ago

This PR introduces an option to dynamically pick the point size

Description

What was changed in this pull request?

With this PR the user can set thesizeBy to density (similar to the opacityBy) which tell regl-scatterplot to automatically pick a point size based on the number of points in the view.

To have better control over the point size, this PR also adds the following three properties:

  1. pointSizeMin to set the minimum point size (this property is ignored unless sizeBy is set to density)
  2. pointSizeMax to set the maximum point size (this property is ignored unless sizeBy is set to density)
  3. fillTarget which controls the proportion of how much the canvas should be filled. E.g., 0.33 means that 33% of the canvas should be filled. This fill target determines at which size and opacity points should be drawn.

Why is it necessary?

Picking the right point size can be as hard as picking the right opacity. This PR makes this easier.

Checklist