Velocity Reviews > extensive scatter plot

# extensive scatter plot

Johannes Korn
Guest
Posts: n/a

 11-24-2010
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!

Robert Kern
Guest
Posts: n/a

 11-24-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

https://lists.sourceforge.net/lists/...tplotlib-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/ap....pyplot.hexbin

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
an underlying truth."
-- Umberto Eco