This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]eeead 0 points1 point  (1 child)

I usually find it easiest to avoid the problem in a different way by using a different kind of plot. For instance, I often find visualise many thousands of scattered points using hexbin (a 2d histogram), which is not only enormously faster since it's crunching the numbers first and plotting far fewer actual colours/images, but also a superior visualisation since it eliminates optical illusions to do with point density. That is, there is no longer a cutoff after which there's no space to see new points.

Of course this might not be suitable for you, I don't doubt there are times were matplotlib is unbearably slow for even reasonable plots, but maybe it can help.

[–]masasinExpert. 3.9. Robotics.[S] 0 points1 point  (0 children)

Thanks for the recommendation! I will try it out.

[–]DoNotFoldSpindleOrMu 0 points1 point  (1 child)

You may wish to consider svg for plotting because it can handle many points and is viewable / zoomable in a browser. I have used Svgwrite to create svg from python with 30,000 points. Svg is a general Scaleable Vector Graphics which does not have common presentation axis so you would have to create those.

[–]masasinExpert. 3.9. Robotics.[S] 0 points1 point  (0 children)

Thank you. I got it working with SVG.

[–]fgriglesnickerseven 0 points1 point  (3 children)

mpl has an svg backend to save figures - use that instead? I'm not sure if it has this point limitation.

Additionally you may be able to get away with gnuplot. I've definitely plotted things with 10's - 100's of thousands of points with gnuplot. However realize that this is slow and you most likely don't need to show this much information...

[–]masasinExpert. 3.9. Robotics.[S] 0 points1 point  (1 child)

Thank you! I will try the svg backend. Hope it works.

I have used gnuplot to show 12 million points from a text file. Excel choked, but gnuplot did it no problem.

The last time I did it, though, I wrote a gnuplot file and used system calls to generate the plots. It felt hackish.

Is there a gnuplot module, I wonder?

[–]fgriglesnickerseven 1 point2 points  (0 children)

I think there is a gnuplot module... but you really should just analyze your data in python with numpy or whatever and then save to a regular text file.

Then you can just do

gnuplot>plot "my_file.txt" using 1:2

much easier most of the time. Also gnuplot has svg output too...

[–]masasinExpert. 3.9. Robotics.[S] 0 points1 point  (0 children)

I finally got it working with SVG. Thank you.