Memory use of multiple plots on single axes

Hi everybody, I am running out of memory while doing something like this:

F= figure()
AX= F.add_subplot(111)
MyClass.plot(axes=AX)
F.show()

MyClass.plot(axes=AX) then does something like this:
...
for i in xrange(100):
    self.MyOtherClass[i].plot(axes=AX)
...

This call finally plots some data, contained in MyOtherClass, onto the
axes "AX" with the usual command:

AX.plot(x,y)

x and y have order 100 points. When I do this, I quickly run out of
memory. Am I hitting a "hard" limit, just because I am trying to plot
too many points (and I am working on kind of an old machine), or am I
somehow wasting memory by plotting several instances onto the same
axes? (of course, plotting each (x,y) on a separate figure and then
closing it would solve the problem, but that is not what I need) Is
there a way I can reduce the memory footprint of the plot? By
comparison, the same plot, using Matlab in a similar fashion as
explained above, can be done without big trouble even if indeed it
takes up quite some memory.

I hope the issue is clear, unfortunately the code is a bit complex and
it is not possible to condense it in a few lines.

Thanks for your feedback.

Hi everybody, I am running out of memory while doing something like this:

F= figure()
AX= F.add_subplot(111)
MyClass.plot(axes=AX)
F.show()

MyClass.plot(axes=AX) then does something like this:
...
for i in xrange(100):
     self.MyOtherClass[i].plot(axes=AX)
...

This call finally plots some data, contained in MyOtherClass, onto the
axes "AX" with the usual command:

AX.plot(x,y)

x and y have order 100 points. When I do this, I quickly run out of
memory. Am I hitting a "hard" limit, just because I am trying to plot
too many points (and I am working on kind of an old machine), or am I
somehow wasting memory by plotting several instances onto the same
axes? (of course, plotting each (x,y) on a separate figure and then
closing it would solve the problem, but that is not what I need) Is
there a way I can reduce the memory footprint of the plot? By
comparison, the same plot, using Matlab in a similar fashion as
explained above, can be done without big trouble even if indeed it
takes up quite some memory.

I hope the issue is clear, unfortunately the code is a bit complex and
it is not possible to condense it in a few lines.

Are you sure it is the plotting that is gobbling the memory? I don't think 100 lines of 100 points should be excessive. When I do a simple test like that, I see about 90 Mb used, and little change after each iteration.

You could try putting in calls to matplotlib.cbook.report_memory() to see where the increases are occurring.

Eric

···

On 2013/03/07 9:50 AM, Giovanni Plantageneto wrote:

Thanks for your feedback.

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users