flekschas / regl-scatterplot

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

filter() seems to change stacking of points in certain cases #197

Open rpadmanabhan opened 22 hours ago

rpadmanabhan commented 22 hours ago

Hi,

I ran into a slightly unexpected behavior when filtering points. I find that in certain cases when filtering points the stacking of the points on the plot changes from what it was originally. Here is a minimal e.g.: https://codepen.io/rpadmanabhan/pen/oNKpLmj If you uncheck Category B, i.e. the blue point, then the red point goes on top of the green one. Hitting it again calls unfilter() and that reverts back to the original stacking. i.e. :

 initial stacking order: [0, 1, 2]
 action: filter index 1
 new stacking order:  [2, 0]

Do you have any pointers for how I could keep the same stacking order as what was initially when the plot was rendered the first time ?

Best, Raghav

flekschas commented 22 hours ago

That's really odd! There might be a bug in the code as to how the filtering affects the draw order of points. Thanks for reporting. I'll take a look over the weekend and next week.