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.


If I ignore the colors, and plot my data using one (or just a few)
plot commands with marker '.', the speed is reasonable.

3) Scatter plots are close, but currently only allow a colormap
indexed by a single float. I'm also concerned about efficiency,
since every point seems to be plotted as a polygon, but I just
want small dots.

I have now verified that

  scatter(x, y, s=1, marker='o')

is quite a bit slower than

  plot(x, y, '.')

I tested with x and y both equal to arange(10**6).

The most noticeable difference is in (re)drawing the window, which
takes around 40s for the scatter plot and 1s for the ordinary plot.

It sounds like there are a few options:

1) Extend plot to allow an array of colour data.

2) Extend PolygonCollection to include points as a special case.

3) Make something like a PointCollection class which specializes
in drawing lots of points.

Can someone suggest which might be the easiest to pursue? And
which might give the fastest plots?