SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(9)
2
(1)
3
(4)
4
(4)
5
(9)
6
(5)
7
(12)
8
(5)
9
(27)
10
(10)
11
(4)
12
13
(6)
14
(12)
15
(16)
16
(13)
17
(9)
18
(1)
19
(2)
20
(4)
21
(9)
22
(5)
23
(2)
24
(6)
25
26
(1)
27
(9)
28
(7)
29
(2)
30
(9)


Showing results of 201

<< < 1 2 3 4 5 6 .. 9 > >> (Page 4 of 9)
From: Daπid <dav...@gm...> - 2011年06月16日 11:15:59
I can run the script you provided up to 600 without noticing any
memory growth (TkAgg backend by default). Using the WxAgg, the memory
leak appears.
If you don't explicitly need WxAgg, I would recommend using TkAgg, or
better Agg if you are not showing the figures. If it is not the case,
more expert and wiser people will have to come to help.
On Thu, Jun 16, 2011 at 11:41 AM, Alain Francés <fra...@it...> wrote:
>
> Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png
>
> indeed I forgot to remove these line from previous tests, sorry.
>
> However it doesn't affect the code behaviour, the problem remains (it fills
> the RAM memory and raises a memory error, see img in att.).
>
> Alain
>
>
> Davidmh wrote:
>>
>> You are importing pylab again before each plot. You have loaded it before.
>>
>> for i,t in enumerate(times):
>>    import pylab as pl # <--ERASE THIS
>>
>>
>>
>> On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances
>> <fra...@it...> wrote:
>>> Hi,
>>>
>>> I have a script that creates and saves figures in a loop. The memory is
>>> increasing at each figure and is not released back, rising a Memory
>>> error.
>>> I used the close() function on the figure object as well as gc.collect(),
>>> but no effect.
>>>
>>> I searched on the net and found a similar problem at
>>> http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size.
>>> The problem here was solved using the close() function but in my case, as
>>> refered before, it doens't work (see code below).
>>>
>>> I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7.
>>>
>>> Thanks for help!
>>>
>>> Alain
>>>
>>>
>>> CODE:
>>>
>>> import pylab as pl
>>> import os, tempfile
>>> def plot_density(filename,i,t,psi_Na):
>>>  pl.figure(figsize=(8,6))
>>>  pl.imshow(abs(psi_Na)**2,origin = 'lower')
>>>  filename = os.path.join(tempfile.gettempdir(), filename +
>>> '_%04d.png'%i)
>>>  pl.savefig(filename)
>>>  pl.clf()
>>>  pl.close()
>>> if __name__ == "__main__":
>>>  x = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>>>  y = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>>>  X,Y = pl.meshgrid(x,y)
>>>  k = 1000000
>>>  omega = 200
>>>  times = pl.linspace(0,100e-3,100,endpoint=False)
>>>  for i,t in enumerate(times):
>>>    import pylab as pl
>>>    psi_Na = pl.sin(k*X-omega*t)
>>>    plot_density('wavefunction',i,t,psi_Na)
>>>    print i
>>> ------------------------------------------------------------------------------
>>> EditLive Enterprise is the world's most technically advanced content
>>> authoring tool. Experience the power of Track Changes, Inline Image
>>> Editing and ensure content is compliant with Accessibility Checking.
>>> http://p.sf.net/sfu/ephox-dev2dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>> ------------------------------------------------------------------------------
>> EditLive Enterprise is the world's most technically advanced content
>> authoring tool. Experience the power of Track Changes, Inline Image
>> Editing and ensure content is compliant with Accessibility Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31858795.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jakob G. <ga...@il...> - 2011年06月16日 10:51:37
Hi,
I'm not sure if it helps, but you can try to plot always into the same 
figure object instead of creating a new one every time you call the 
plot_density function.
I would create one figure in advance and pass this the plot_density 
method. Within the method set the figure active (pl.figure(fig.number)), 
plot the data, save the figure and clear the figure canvas (pl.clf() 
should work here, I guess).
Well, as mentioned I'm not sure but you could give it a try.
br
Jakob
Alain Francés wrote:
> Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png 
> 
> indeed I forgot to remove these line from previous tests, sorry.
> 
> However it doesn't affect the code behaviour, the problem remains (it fills
> the RAM memory and raises a memory error, see img in att.).
> 
> Alain 
> 
> 
> Davidmh wrote:
>> You are importing pylab again before each plot. You have loaded it before.
>>
>> for i,t in enumerate(times):
>> import pylab as pl # <--ERASE THIS
>>
>>
>>
>> On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances
>> <fra...@it...> wrote:
>>> Hi,
>>>
>>> I have a script that creates and saves figures in a loop. The memory is
>>> increasing at each figure and is not released back, rising a Memory
>>> error.
>>> I used the close() function on the figure object as well as gc.collect(),
>>> but no effect.
>>>
>>> I searched on the net and found a similar problem at
>>> http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size.
>>> The problem here was solved using the close() function but in my case, as
>>> refered before, it doens't work (see code below).
>>>
>>> I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7.
>>>
>>> Thanks for help!
>>>
>>> Alain
>>>
>>>
>>> CODE:
>>>
>>> import pylab as pl
>>> import os, tempfile
>>> def plot_density(filename,i,t,psi_Na):
>>> pl.figure(figsize=(8,6))
>>> pl.imshow(abs(psi_Na)**2,origin = 'lower')
>>> filename = os.path.join(tempfile.gettempdir(), filename +
>>> '_%04d.png'%i)
>>> pl.savefig(filename)
>>> pl.clf()
>>> pl.close()
>>> if __name__ == "__main__":
>>> x = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>>> y = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>>> X,Y = pl.meshgrid(x,y)
>>> k = 1000000
>>> omega = 200
>>> times = pl.linspace(0,100e-3,100,endpoint=False)
>>> for i,t in enumerate(times):
>>> import pylab as pl
>>> psi_Na = pl.sin(k*X-omega*t)
>>> plot_density('wavefunction',i,t,psi_Na)
>>> print i
>>> ------------------------------------------------------------------------------
From: Alain F. <fra...@it...> - 2011年06月16日 09:41:34
Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png 
indeed I forgot to remove these line from previous tests, sorry.
However it doesn't affect the code behaviour, the problem remains (it fills
the RAM memory and raises a memory error, see img in att.).
Alain 
Davidmh wrote:
> 
> You are importing pylab again before each plot. You have loaded it before.
> 
> for i,t in enumerate(times):
> import pylab as pl # <--ERASE THIS
> 
> 
> 
> On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances
> <fra...@it...> wrote:
>> Hi,
>>
>> I have a script that creates and saves figures in a loop. The memory is
>> increasing at each figure and is not released back, rising a Memory
>> error.
>> I used the close() function on the figure object as well as gc.collect(),
>> but no effect.
>>
>> I searched on the net and found a similar problem at
>> http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size.
>> The problem here was solved using the close() function but in my case, as
>> refered before, it doens't work (see code below).
>>
>> I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7.
>>
>> Thanks for help!
>>
>> Alain
>>
>>
>> CODE:
>>
>> import pylab as pl
>> import os, tempfile
>> def plot_density(filename,i,t,psi_Na):
>>  pl.figure(figsize=(8,6))
>>  pl.imshow(abs(psi_Na)**2,origin = 'lower')
>>  filename = os.path.join(tempfile.gettempdir(), filename +
>> '_%04d.png'%i)
>>  pl.savefig(filename)
>>  pl.clf()
>>  pl.close()
>> if __name__ == "__main__":
>>  x = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>>  y = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>>  X,Y = pl.meshgrid(x,y)
>>  k = 1000000
>>  omega = 200
>>  times = pl.linspace(0,100e-3,100,endpoint=False)
>>  for i,t in enumerate(times):
>>    import pylab as pl
>>    psi_Na = pl.sin(k*X-omega*t)
>>    plot_density('wavefunction',i,t,psi_Na)
>>    print i
>> ------------------------------------------------------------------------------
>> EditLive Enterprise is the world's most technically advanced content
>> authoring tool. Experience the power of Track Changes, Inline Image
>> Editing and ensure content is compliant with Accessibility Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
> 
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31858795.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2011年06月15日 23:46:22
Attachments: testqt4.py
On 06/15/2011 01:15 PM, zb wrote:
> Hi
>
> You could try the example here:
>
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html
>
> Look at the memory grow. It does the same in my program.
I added a call to cbook.report_memory, and shortened the timer to 0.1 
seconds in the attached version.
There is no memory leakage evident when I run this on my system.
Eric
>
> Cheers
>
> --- On *Wed, 6/15/11, Eric Firing /<ef...@ha...>/* wrote:
>
>
> From: Eric Firing <ef...@ha...>
> Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
> To: mat...@li...
> Date: Wednesday, June 15, 2011, 6:33 PM
>
> On 06/15/2011 12:13 PM, zb wrote:
> > Hi
> >
> > I have a loop that updates a graph by calling
> >
> > self.fig.canvas.draw()
> >
> > But every time it updates the graph, the memory usage goes up. If the
> > program runs for one hour, the memory is gone (things start to
> run slow
> > too). I've tried to close() objects but the only thing that
> brings back
> > the ram memory is to close the whole application.
> >
> > I have read this note in the documentation (but it applies to
> pyplot):
> >
> > "If you are making a long sequence of figures, you need to be
> aware of
> > one more thing: the memory requiredfor a figure is not completely
> > released until the figure is explicitly closed with close(). Deleting
> > all references to the figure, and/or using the window manager to kill
> > the window in which the figure appears on the screen, is not enough,
> > because pyplot maintains internal references until close() is
> called."
> >
> > What could I do in pyqt4 to release the memory?
> >
> > Thanks
>
> Please provide a simple standalone script that demonstrates the problem.
>
> Eric
>
From: Eric F. <ef...@ha...> - 2011年06月15日 23:30:46
On 06/15/2011 12:53 PM, jonasr wrote:
>
> Thank you for the fast reply, according to you line and "line," shouldt make
> a difference in this case,
No, that's not what I said. Using "line" gives you a list with one 
element, but using "line," gives you the element itself, not the list.
> i tried the code with line and line, and it only works with line, ?
>
> so you say if i use
> a=[1,2,3]
> then b, = a should be 1 ? i just get the error message to many values to
> unpack ...
Yes, when you use this automatic unpacking the number of items has to 
match. You can only use
a, b = rhs
when you *know* rhs will be a sequence with two, and only two, elements.
Eric
>
>
>
> efiring wrote:
>>
>> On 06/15/2011 12:35 PM, jonasr wrote:
>>>
>>> hello,
>>>
>>> a lot of matplotlib examples i saw included the usage of line, i.e.
>>>
>>> from pylab import *
>>> import time
>>>
>>> ion()
>>>
>>> tstart = time.time() # for profiling
>>> x = arange(0,2*pi,0.01) # x-array
>>> line, = plot(x,sin(x))
>>> for i in arange(1,200):
>>> line.set_ydata(sin(x+i/10.0)) # update the data
>>> draw() # redraw the canvas
>>>
>>> print 'FPS:' , 200/(time.time()-tstart)
>>>
>>> can anybody explain to me whats the difference between line and line, ?
>>>
>>
>> plot returns a list of lines, and
>>
>> line, = plot(...)
>>
>> returns the first one (which in your case is the only one)
>>
>> It is the same as
>>
>> line = plot(...)[0]
>>
>> It is a special case of Python's sequence unpacking, e.g.:
>>
>> a, b, c = [1, 2, 3]
>>
>> Eric
>>
>> ------------------------------------------------------------------------------
>> EditLive Enterprise is the world's most technically advanced content
>> authoring tool. Experience the power of Track Changes, Inline Image
>> Editing and ensure content is compliant with Accessibility Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
From: zb <za...@ya...> - 2011年06月15日 23:15:15
Hi
You could try the example here:
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html
Look at the memory grow. It does the same in my program.
Cheers
--- On Wed, 6/15/11, Eric Firing <ef...@ha...> wrote:
From: Eric Firing <ef...@ha...>
Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
To: mat...@li...
Date: Wednesday, June 15, 2011, 6:33 PM
On 06/15/2011 12:13 PM, zb wrote:
> Hi
>
> I have a loop that updates a graph by calling
>
> self.fig.canvas.draw()
>
> But every time it updates the graph, the memory usage goes up. If the
> program runs for one hour, the memory is gone (things start to run slow
> too). I've tried to close() objects but the only thing that brings back
> the ram memory is to close the whole application.
>
> I have read this note in the documentation (but it applies to pyplot):
>
> "If you are making a long sequence of figures, you need to be aware of
> one more thing: the memory requiredfor a figure is not completely
> released until the figure is explicitly closed with close(). Deleting
> all references to the figure, and/or using the window manager to kill
> the window in which the figure appears on the screen, is not enough,
> because pyplot maintains internal references until close() is called."
>
> What could I do in pyqt4 to release the memory?
>
> Thanks
Please provide a simple standalone script that demonstrates the problem.
Eric
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: jonasr <jon...@we...> - 2011年06月15日 22:53:56
Thank you for the fast reply, according to you line and "line," shouldt make
a difference in this case, 
i tried the code with line and line, and it only works with line, ?
so you say if i use
a=[1,2,3]
then b, = a should be 1 ? i just get the error message to many values to
unpack ... 
efiring wrote:
> 
> On 06/15/2011 12:35 PM, jonasr wrote:
>>
>> hello,
>>
>> a lot of matplotlib examples i saw included the usage of line, i.e.
>>
>> from pylab import *
>> import time
>>
>> ion()
>>
>> tstart = time.time() # for profiling
>> x = arange(0,2*pi,0.01) # x-array
>> line, = plot(x,sin(x))
>> for i in arange(1,200):
>> line.set_ydata(sin(x+i/10.0)) # update the data
>> draw() # redraw the canvas
>>
>> print 'FPS:' , 200/(time.time()-tstart)
>>
>> can anybody explain to me whats the difference between line and line, ?
>>
> 
> plot returns a list of lines, and
> 
> line, = plot(...)
> 
> returns the first one (which in your case is the only one)
> 
> It is the same as
> 
> line = plot(...)[0]
> 
> It is a special case of Python's sequence unpacking, e.g.:
> 
> a, b, c = [1, 2, 3]
> 
> Eric
> 
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/line%2C-tp31855827p31855959.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2011年06月15日 22:43:00
On 06/15/2011 12:35 PM, jonasr wrote:
>
> hello,
>
> a lot of matplotlib examples i saw included the usage of line, i.e.
>
> from pylab import *
> import time
>
> ion()
>
> tstart = time.time() # for profiling
> x = arange(0,2*pi,0.01) # x-array
> line, = plot(x,sin(x))
> for i in arange(1,200):
> line.set_ydata(sin(x+i/10.0)) # update the data
> draw() # redraw the canvas
>
> print 'FPS:' , 200/(time.time()-tstart)
>
> can anybody explain to me whats the difference between line and line, ?
>
plot returns a list of lines, and
line, = plot(...)
returns the first one (which in your case is the only one)
It is the same as
line = plot(...)[0]
It is a special case of Python's sequence unpacking, e.g.:
a, b, c = [1, 2, 3]
Eric
From: jonasr <jon...@we...> - 2011年06月15日 22:35:46
hello,
a lot of matplotlib examples i saw included the usage of line, i.e.
from pylab import *
import time
ion()
tstart = time.time() # for profiling
x = arange(0,2*pi,0.01) # x-array
line, = plot(x,sin(x))
for i in arange(1,200):
 line.set_ydata(sin(x+i/10.0)) # update the data
 draw() # redraw the canvas
print 'FPS:' , 200/(time.time()-tstart)
can anybody explain to me whats the difference between line and line, ? 
-- 
View this message in context: http://old.nabble.com/line%2C-tp31855827p31855827.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2011年06月15日 22:33:50
On 06/15/2011 12:13 PM, zb wrote:
> Hi
>
> I have a loop that updates a graph by calling
>
> self.fig.canvas.draw()
>
> But every time it updates the graph, the memory usage goes up. If the
> program runs for one hour, the memory is gone (things start to run slow
> too). I've tried to close() objects but the only thing that brings back
> the ram memory is to close the whole application.
>
> I have read this note in the documentation (but it applies to pyplot):
>
> "If you are making a long sequence of figures, you need to be aware of
> one more thing: the memory requiredfor a figure is not completely
> released until the figure is explicitly closed with close(). Deleting
> all references to the figure, and/or using the window manager to kill
> the window in which the figure appears on the screen, is not enough,
> because pyplot maintains internal references until close() is called."
>
> What could I do in pyqt4 to release the memory?
>
> Thanks
Please provide a simple standalone script that demonstrates the problem.
Eric
From: zb <za...@ya...> - 2011年06月15日 22:13:23
Hi
I have a loop that updates a graph by calling 
self.fig.canvas.draw()
But every time it updates the graph, the memory usage goes up. If the program runs for one hour, the memory is gone (things start to run slow too). I've tried to close() objects but the only thing that brings back the ram memory is to close the whole application.
I have read this note in the documentation (but it applies to pyplot):
"If you are making a long sequence of figures, you need to be aware of one more thing: the memory requiredfor a figure is not completely released until the figure is explicitly closed with close(). Deleting all references to the figure, and/or using the window manager to kill the window in which the figure appears on the screen, is not enough, because pyplot maintains internal references until close() is called."
What could I do in pyqt4 to release the memory?
Thanks
 
From: Rebecca G. <atl...@gm...> - 2011年06月15日 20:29:42
Hi all,
I am trying to install matplotlib on my Mac OS X 10.6.6. I currently have
Python 2.7.2 installed. I tried installing
***matplotlib-1.0.1-python.org-32bit-py2.7-macosx10.3.dmg.
The installation appears to run fine, but when I try to import pylab * I am
getting the following error message:
>>> from numpy import *
>>> import pylab
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py",
line 1, in <module>
 from matplotlib.pylab import *
 File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py",
line 220, in <module>
 from matplotlib import mpl # pulls in most modules
 File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl.py",
line 1, in <module>
 from matplotlib import artist
 File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 6, in <module>
 from transforms import Bbox, IdentityTransform, TransformedBbox,
TransformedPath
 File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py",
line 34, in <module>
 from matplotlib._path import affine_transform
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so,
2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so:
no matching architecture in universal wrapper
I am new to Python and any help would be greatly appreciated.
Thanks,
Rebecca
Hi all,
Just wanted to know how to go about when I have to do my color mapping
not only with respect to range of values on y-axis but also based on
some other conditions as well. i.e, say ( <rangeon y-axis> && <condtion1> &&
<condition2> ) where condition1 could be occurance of some event say,
a flag1 is set true and condition2 may be another flag2 set to false.
Just wanted to use my color mapping not only based on boundaries but
also on occurance of other events as well.
In this context do i have to modify the source of BoundaryNorm in
matplotlib function...?? Can you give me some insights into this.
Regards,
Ravikanth
From: Michael D. <md...@st...> - 2011年06月15日 15:59:48
Can you provide a standalone script that reproduces the problem? How 
many points are you plotting?
Cheers,
Mike
On 06/15/2011 06:09 AM, Francesco Benincasa wrote:
> Hi all,
> I've noticed that savefig is very slow when I draw wind (using "quiver" and
> "quiverkey" commands).
>
> If I don't draw winds is very fast (2 seconds against 13 seconds).
>
> Is possible to make the program faster? Any idea?
>
> I use the 'Agg' backend and the latest version of matplotlib.
>
> Thank you in advance,
>
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Ravi K. V. <vvn...@gm...> - 2011年06月15日 15:25:05
Hi all,
I am a beginner in python and matplotlib. I need to implement a graph with
multiple
colors in it.
In a way, I have a function which varies with respect to time and
amplitude. I have time on x-axis and amplitude on y-axis. Lets say the
amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9,
10-13. I need to plot the graph in such a way that, when the values of
amplitude are in a particular range say 1-3, the color of graph should
be red.
If the amplitude is in the range from 3-5 the graph need to be in
color blue etc..,
There is no specific pattern of variation of the amplitude with respect to
time i.e at time instance say 3 seconds. the amplitude can be 11 and next
instance amplitude comes down to say 3.
I did find an example post
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fdefe924cc7d4d31
but I was not able to figure out how to use it.
Can somebody guide me on this, how to achive this functionality.
Regards,
Ravikanth
From: Jakob G. <ga...@il...> - 2011年06月15日 14:22:20
Hi,
I searched through various previous posts and it seems that the 
z-ordering issue with mplot3d has been met many times. When multiple 
Poly3DCollections are added to an Axes3D object, e.g. via multiple 
plot_surface commands, the z-ordering routine is not capable of 
producing the right output.
However a single Poly3DCollection seems fine even for moderately complex 
surfaces (see e.g. mplot3d example code: surface3d_radial_demo.py).
In this context I wonder if it is possible to combine multiple 
Poly3DObjects and add only this newly created one to the Axes3D object. 
This way the internal z-ordering should be capable of producing the 
right output, I guess. Of course tricky problems like intersecting faces 
cannot be overcome by this simple approach.
Thanks for your comments!
Jakob
From: Daπid <dav...@gm...> - 2011年06月15日 10:52:26
You are importing pylab again before each plot. You have loaded it before.
for i,t in enumerate(times):
 import pylab as pl # <--ERASE THIS
On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances
<fra...@it...> wrote:
> Hi,
>
> I have a script that creates and saves figures in a loop. The memory is increasing at each figure and is not released back, rising a Memory error.
> I used the close() function on the figure object as well as gc.collect(), but no effect.
>
> I searched on the net and found a similar problem at http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size. The problem here was solved using the close() function but in my case, as refered before, it doens't work (see code below).
>
> I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7.
>
> Thanks for help!
>
> Alain
>
>
> CODE:
>
> import pylab as pl
> import os, tempfile
> def plot_density(filename,i,t,psi_Na):
>  pl.figure(figsize=(8,6))
>  pl.imshow(abs(psi_Na)**2,origin = 'lower')
>  filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i)
>  pl.savefig(filename)
>  pl.clf()
>  pl.close()
> if __name__ == "__main__":
>  x = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>  y = pl.linspace(-6e-6,6e-6,128,endpoint=False)
>  X,Y = pl.meshgrid(x,y)
>  k = 1000000
>  omega = 200
>  times = pl.linspace(0,100e-3,100,endpoint=False)
>  for i,t in enumerate(times):
>    import pylab as pl
>    psi_Na = pl.sin(k*X-omega*t)
>    plot_density('wavefunction',i,t,psi_Na)
>    print i
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Alain P. F. <fra...@it...> - 2011年06月15日 10:22:26
Hi,
I have a script that creates and saves figures in a loop. The memory is increasing at each figure and is not released back, rising a Memory error.
I used the close() function on the figure object as well as gc.collect(), but no effect.
I searched on the net and found a similar problem at http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size. The problem here was solved using the close() function but in my case, as refered before, it doens't work (see code below). 
I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7.
Thanks for help!
Alain
CODE:
import pylab as pl
import os, tempfile
def plot_density(filename,i,t,psi_Na):
 pl.figure(figsize=(8,6))
 pl.imshow(abs(psi_Na)**2,origin = 'lower')
 filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i)
 pl.savefig(filename)
 pl.clf()
 pl.close()
if __name__ == "__main__":
 x = pl.linspace(-6e-6,6e-6,128,endpoint=False)
 y = pl.linspace(-6e-6,6e-6,128,endpoint=False)
 X,Y = pl.meshgrid(x,y)
 k = 1000000
 omega = 200
 times = pl.linspace(0,100e-3,100,endpoint=False)
 for i,t in enumerate(times):
 import pylab as pl
 psi_Na = pl.sin(k*X-omega*t)
 plot_density('wavefunction',i,t,psi_Na)
 print i
From: Francesco B. <fra...@bs...> - 2011年06月15日 10:12:19
Hi all,
I've noticed that savefig is very slow when I draw wind (using "quiver" and
"quiverkey" commands).
If I don't draw winds is very fast (2 seconds against 13 seconds).
Is possible to make the program faster? Any idea?
I use the 'Agg' backend and the latest version of matplotlib.
Thank you in advance,
-- 
----------------------------------------------------------------------
Francesco Benincasa
Research Support Engineer - Earth Sciences Department
Barcelona Supercomputing Center - Centro Nacional de Supercomputación
Edificio Nexus II
c/ Jordi Girona 29, 08034 Barcelona, Spain
phone +34 934137612
fax +34 934137721
mailto: fra...@bs...
BSC web page: http://www.bsc.es/
----------------------------------------------------------------------
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.
http://www.bsc.es/disclaimer.htm
From: Uri L. <las...@mi...> - 2011年06月14日 22:04:32
In the Legend Guide:
http://matplotlib.sourceforge.net/users/legend_guide.html
it gives a list of artists that the legend can handle (e.g., Line2D, Patch,
etc.). However, it leaves out CircleCollection.
Best,
Uri
...................................................................................
Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
las...@mi...
From: Eric F. <ef...@ha...> - 2011年06月14日 19:22:51
On 06/14/2011 12:36 AM, Bala subramanian wrote:
> Friends,
> I have a simple array like this data=[0,0,1,1,3,1,0,1,1,3]. I want to
> make a plot (using pcolor/matshow) by giving distinct color to each
> integer. Something like green for zero, red for 1 and blue for 3. Your
> suggestions / any pseudo code would be of great help.
>
> Thanks,
> Bala
With ipython -pylab:
data=[0,0,1,1,3,1,0,1,1,3]
z = np.array(data, dtype=int)
z.shape = 2,5
cmap = mpl.colors.ListedColormap(['g', 'r', 'k', 'b'])
matshow(z, cmap=cmap)
If the argument to matshow or pcolor (or anything doing color mapping) 
is an ndarray of integers, then those integers are used directly to 
index into the lookup table of the colormap. ListedColormap provides a 
simple way of generating a colormap with a sequence of discrete colors.
Eric
From: xpli02 <xp...@gm...> - 2011年06月14日 16:10:20
I want to annotate a 3D point when I use a mouse to click it. In order to
know which point I am clicking, I am thinking to compare the mouse 2d
coordinate and that for this point. But I don't know how to get the 2D view
coordinate for this point. Does any one know how to do this? Or you have any
a better way to annotate 3d points? Thank you very much!
-- 
View this message in context: http://old.nabble.com/mplot3d%3A-How-to-convert-a-3D-coordinate-to-a-2D-view-coordinate-tp31844255p31844255.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <fa...@si...> - 2011年06月14日 13:55:14
Dear Sir/Ms:
 I am using matplotlib and pyqt4,and i want design a qt program for display map.Now i have embed matplotlib in qt,but i can not embed basemap in qt,i need get your help!Thanks!
Bestwish!
A python student。
From: <fa...@si...> - 2011年06月14日 13:55:04
Dear Sir/Ms:
 I am using matplotlib and pyqt4,and i want design a qt program for display map.Now i have embed matplotlib in qt,but i can not embed basemap in qt,i need get your help!Thanks!
Bestwish!
A python student。
From: Justin M. <jn...@gm...> - 2011年06月14日 12:47:11
On Mon, Jun 13, 2011 at 8:37 AM, Andrea Crotti <and...@gm...>wrote:
>
> I found this question asked other times, but trying myself there is no
> way that I get something working..
>
> So I just want to generate a pdf from a plot with the smallest possible
> margin, and I was trying for example this:
>
> fig = plt.figure(1)
> fig.frameon = False
> plt.plot(range(10), range(10))
> plt.savefig('prova1.pdf')
>
> But the margin is still all there..
> Am I missing something?
>
> Try this:
 ax = gca() # get the current axes
 # fill the whole figure area from (0,0) to (1,1)
 # units are in proportion to the figure
 ax.set_position((0,0,1,1))
2 messages has been excluded from this view by a project administrator.

Showing results of 201

<< < 1 2 3 4 5 6 .. 9 > >> (Page 4 of 9)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /