extensive scatter plot

Discussion in 'Python' started by Johannes Korn, Nov 24, 2010.

  1. 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) & (y_grid == y_points) )
    counter_grid[ind] += 1

    This is really slow. I'm sure there's a better solution already out there.

    Kind regards!
    Johannes Korn, Nov 24, 2010
    #1
    1. Advertising

  2. Johannes Korn

    Robert Kern Guest

    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)& (y_grid == y_points) )
    > 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
    Robert Kern, Nov 24, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dr. Colombes
    Replies:
    1
    Views:
    1,015
    John Hunter
    Feb 10, 2005
  2. Derek Basch

    Matplotlib logarithmic scatter plot

    Derek Basch, Feb 27, 2006, in forum: Python
    Replies:
    9
    Views:
    4,873
    evander21
    Nov 3, 2010
  3. C Barrington-Leigh
    Replies:
    1
    Views:
    625
    C Barrington-Leigh
    Sep 12, 2010
  4. Replies:
    1
    Views:
    96
    EricGarlic
    Nov 26, 2013
  5. Jamie Mitchell

    Adding R squared value to scatter plot

    Jamie Mitchell, May 21, 2014, in forum: Python
    Replies:
    2
    Views:
    55
    Jamie Mitchell
    Jun 5, 2014
Loading...

Share This Page