plotting large number of points of different colours

Dan Christensen <jdc@...955...> writes:

I'd like to plot a large number of points (say 10**6 or 10**7) with
different colours. The colours will not naturally be parametrized by
a single float, but rather the rgb components will all vary
independently, so I don't think I can use a colormap.

I ended up not using matplotlib for this, but for the sake of anyone
with a similar question, I'll briefly say what I did: I had my python
program write out raw postscript. This turned out to be extremely
efficient in both time and space, and allows very high-resolution
printouts from a relatively small postscript file. For example, one
plot with 13.5 million points is stored in an uncompressed postscript
file which is only 24MB, less than 2 bytes per point (and the points
vary in x, y coordinates, R,G,B colours and radii). I'm able to do
this by taking into account (non-linear) symmetries of the plot
(making the postscript code do some of the calculations) and by taking
into account patterns in the colours and radii.

I'd still love it if matplotlib's scatter command could handle small
round dots more efficiently, since I use it for most of my other work,
but for now the above is working for me.