Open andrewRowlinson opened 3 years ago
I've carried out a bit more investigation as to what happens when you pass in a very large number of points into #34
For n<20,000 it will render within a couple of seconds on my mid-range 2019 laptop, so the user experience is fine in those situations. After that however things degrade quite rapidly, with n = 150,000 taking several minutes which is probably unacceptable.
Therefore I've investigated the following alternatives from https://stackoverflow.com/questions/20105364/how-can-i-make-a-scatter-plot-colored-by-density-in-matplotlib
Option 1. mpl-scatter-density
Pros:
Cons:
Option 2. np.histogram2d
Pros:
Cons:
With this in mind I propose to resubmit #34 with option 2 implemented which gives significant speed improvement and the option to plot the highest density points last so they are on top.
Add a scatter density method to the Pitch classes.
Inspiration:
In principle, this could be added by using the
c
andcmap
arguments of Axes.scatter. Calculating the density via kernel density estimation and using this as thec
argument.