A fast scatter plot
h=fastscatter(X,Y,C [,markertype,property-value pairs])
An illustrative example of the speed-up when using fastscatter over scatter:
tic; for ii=1:10, clf; fastscatter(X,Y,C); drawnow; end; fastscatter_time=toc
tic; for ii=1:10, clf; scatter(X,Y,S,C); drawnow; end; regularscatter_time=toc
fastscatter_time = 3.4 seconds
regularscatter_time = 63.3 seconds
speed_increase = 18x
And for N=400000, the performance boost was ~38x.
Unfortunately, this function doesn't work if the amount of points is 1 or 2.
Error using mesh (line 70)
Z must be a matrix, not a scalar or vector.
Error in fastscatter (line 40)
@YounesN: i think this is caused by a bug in image for R2014b. Try this workaround:
This function is excellent. The inbuilt scatter function was slowing my computer to a halt when I tried to plot > 200,000 points, but with fastscatter it's no problem. Thanks for sharing, Aslak!
The speedup is amazing and helps a lot but I'm having difficulty with the colorbar when superimposing scatter points on an aerial image , using fastscatter() after image(). The colorbar doesn't correspond to the colors in the plot. Would highly appreciate your help.
bug fix... too fast with submit
Improved performance and nan-handling.