extensive scatter plot

Robert Kern robert.kern at gmail.com
Wed Nov 24 17:02:29 CET 2010


On 11/24/10 9:12 AM, Johannes Korn wrote:
> Hi,
>
> I would like to produce a scatter plot with roughly 200 mio points.
> Because the points are so numerous I rather need a point density plot.
>
> I use numpy. Right now I loop over the individual data points and make a
> where query on a meshgrid.
>
> ind = where((x_grid == x_points[i])&  (y_grid == y_points[i]) )
> counter_grid[ind] += 1
>
> This is really slow. I'm sure there's a better solution already out there.
>
> Kind regards!

You will want to ask numpy questions on the numpy mailing list:

   http://www.scipy.org/Mailing_Lists

If you are using a particular plotting package like matplotlib, you will want to 
ask your plotting questions on their mailing lists. E.g.

   https://lists.sourceforge.net/lists/listinfo/matplotlib-users

If you are doing your own plotting, you will want to use the numpy.histogram2d() 
function to make a 2D histogram that can be plotted using a colormapped image. 
If you are using matplotlib, try matplotlib.pyplot.hexbin().

   http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.hexbin

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list