On 10/10/2013 15:05, Martin MOKREJŠ wrote:
> Hi,
>   rendering some of my charts takes almost 50GB of RAM. I believe below is a 
> stracktrace
> of one such situation when it already took 15GB. Would somebody comments on 
> what is
> matplotlib doing at the very moment? Why the recursion?
> 
>   The charts had to have 262422 data points in a 2D scatter plot, each point 
> has assigned
> its own color. They are in batches so that there are 153 distinct colors but 
> nevertheless,
> I assigned to each data point a color value. There are 153 legend items also 
> (one color
> won't be used).

Hello Martin,

can I ask what is the meaning of plotting a scatter plot with 200
thousands points in it?  Either you visualize it on a screen much larger
than mine, or you are not going to be able to distinguish the single
data points. Maybe you should rethink the visualization tool you are using.

Nevertheless, I'm perfectly able to plot a scatter plot with 262422 data
points each with its own color just fine, and the python process
consumes a few hundred Mb of ram (having quite a few other datasets
loaded in memory)::

    import numpy as np
    import matplotlib.pyplot as plt
    n = 262422
    x = np.random.rand(n)
    y = np.random.rand(n)
    c = np.random.rand(n)
    f = plt.figure()
    a = f.add_subplot(111)
    a.scatter(x, y, c=c, s=50)
    plt.show()

and a possible solution using exactly 153 different colors, but again, I
don't see how you can distinguish between hundreds different shades of
colors::

 n = 262422 #22
    ncolors = 153
    x = np.random.rand(n)
    y = np.random.rand(n)
    c = np.random.rand(ncolors)
    f = plt.figure()
    a = f.add_subplot(111)
    for i in xrange(n // ncolors):
        a.scatter(x[i*ncolors:(i+1)*ncolors],
                  y[i*ncolors:(i+1)*ncolors], c=c, s=50)
    plt.show()

Unfortunately the code you provide is too contrived to be useful to
understand the root cause of your problem.

Cheers,
Daniele


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to