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
(4)
2
(20)
3
(8)
4
(10)
5
(4)
6
(8)
7
(4)
8
(9)
9
(11)
10
(12)
11
(13)
12
(3)
13
(17)
14
(4)
15
16
(10)
17
(9)
18
(11)
19
(4)
20
(17)
21
(6)
22
(9)
23
(35)
24
(17)
25
(9)
26
(16)
27
(17)
28
(14)

Showing 12 results of 12

From: Robert K. <rob...@gm...> - 2009年02月10日 22:58:02
On 2009年02月10日 16:50, Gustavo Blando wrote:
> Awesome Robert, thanks.
> Here is the Python path.
>
> C:\Python25\Lib\site-packages\numpy;C:\Python25\Lib\site-packages\matplotlib;C:\Python25\Lib\site-packages\scipy;C:\Python25\Lib\site-packages\pyreadline;C:\Python25\Lib\site-packages;C:\StatEye\v5_2;C:\Python25\Lib\site-packages\numpy;C:\Python25\Lib\site-packages\matplotlib;C:\Python25\Lib\site-packages\scipy;C:\Python25\Lib\site-packages\pyreadline;C:\Python25\Lib\site-packages\numpy;C:\Python25\Lib\site-packages\matplotlib;C:\Python25\Lib\site-packages\scipy;C:\Python25\Lib\site-packages\pyreadline;C:\Python25\Lib\site-packages
Okay, none of that is necessary except for C:\StatEye\v5_2 . site-packages will 
already be on your sys.path, so putting it on the PYTHONPATH is unnecessary. The 
package directories like numpy and matplotlib definitely should *not* be on your 
PYTHONPATH or sys.path. It is the directory that *contains* your packages that 
needs to be on the sys.path; but as I already noted, site-packages is built in, 
so you don't need to add it yourself.
-- 
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
From: Gustavo B. <Gus...@Su...> - 2009年02月10日 22:51:23
Awesome Robert, thanks.
Here is the Python path.
C:\Python25\Lib\site-packages\numpy;C:\Python25\Lib\site-packages\matplotlib;C:\Python25\Lib\site-packages\scipy;C:\Python25\Lib\site-packages\pyreadline;C:\Python25\Lib\site-packages;C:\StatEye\v5_2;C:\Python25\Lib\site-packages\numpy;C:\Python25\Lib\site-packages\matplotlib;C:\Python25\Lib\site-packages\scipy;C:\Python25\Lib\site-packages\pyreadline;C:\Python25\Lib\site-packages\numpy;C:\Python25\Lib\site-packages\matplotlib;C:\Python25\Lib\site-packages\scipy;C:\Python25\Lib\site-packages\pyreadline;C:\Python25\Lib\site-packages
Thanks
Gus
Robert Kern wrote:
> On 2009年02月10日 15:26, Gustavo Blando wrote:
> 
>> Hi, I am new to Python, and I am trying to install the matplotlib but it is
>> 
>>> not working.
>>> I would appreciate your help.
>>> 
>> I am using Python with the PythonWin environment.
>> I have created a PYTHONPATH on my environment variables to make
>> sure I point to all the libraries.
>> I have installed the numpy, scipy and other libraries that seems
>> to work just fine.
>>
>> BUT when I try to load the matplotlib, this is what I get:
>>
>> 
>>> ERROR:
>>> ======
>>> from matplotlib import *
>>> Traceback (most recent call last):
>>> File "<interactive input>", line 1, in<module>
>>> File "C:\Python25\Lib\site-packages\matplotlib\__init__.py", line 97, in
>>> <module>
>>> import distutils.sysconfig
>>> File "C:\Python25\Lib\site-packages\numpy\distutils\__init__.py", line 6,
>>> in<module>
>>> import ccompiler
>>> File "C:\Python25\Lib\site-packages\numpy\distutils\ccompiler.py", line 7,
>>> in<module>
>>> from distutils import ccompiler
>>> ImportError: cannot import name ccompiler
>>> 
>>> - It's having a problem with ccompiler, but ccompiler.py is on that
>>> directory.
>>> 
>
> It looks like you have a problem with your PYTHONPATH. You shouldn't have 
> c:\Python25\Lib\site-packages\numpy\ on your PYTHONPATH. Show me your 
> PYTHONPATH, and I can point out what else is wrong.
>
> 
From: Robert K. <rob...@gm...> - 2009年02月10日 22:45:22
On 2009年02月10日 15:26, Gustavo Blando wrote:
> Hi, I am new to Python, and I am trying to install the matplotlib but it is
>> not working.
>> I would appreciate your help.
> I am using Python with the PythonWin environment.
> I have created a PYTHONPATH on my environment variables to make
> sure I point to all the libraries.
> I have installed the numpy, scipy and other libraries that seems
> to work just fine.
>
> BUT when I try to load the matplotlib, this is what I get:
>
>> ERROR:
>> ======
>> from matplotlib import *
>> Traceback (most recent call last):
>> File "<interactive input>", line 1, in<module>
>> File "C:\Python25\Lib\site-packages\matplotlib\__init__.py", line 97, in
>> <module>
>> import distutils.sysconfig
>> File "C:\Python25\Lib\site-packages\numpy\distutils\__init__.py", line 6,
>> in<module>
>> import ccompiler
>> File "C:\Python25\Lib\site-packages\numpy\distutils\ccompiler.py", line 7,
>> in<module>
>> from distutils import ccompiler
>> ImportError: cannot import name ccompiler
>
>> - It's having a problem with ccompiler, but ccompiler.py is on that
>> directory.
It looks like you have a problem with your PYTHONPATH. You shouldn't have 
c:\Python25\Lib\site-packages\numpy\ on your PYTHONPATH. Show me your 
PYTHONPATH, and I can point out what else is wrong.
-- 
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
From: Gustavo B. <Gus...@Su...> - 2009年02月10日 21:27:54
Hi, I am new to Python, and I am trying to install the matplotlib but it is
> not working.
> I would appreciate your help.
 I am using Python with the PythonWin environment. 
 I have created a PYTHONPATH on my environment variables to make
 sure I point to all the libraries.
 I have installed the numpy, scipy and other libraries that seems
 to work just fine.
BUT when I try to load the matplotlib, this is what I get:
>
> ERROR:
> ======
> from matplotlib import *
> Traceback (most recent call last):
> File "<interactive input>", line 1, in <module>
> File "C:\Python25\Lib\site-packages\matplotlib\__init__.py", line 97, in
> <module>
> import distutils.sysconfig
> File "C:\Python25\Lib\site-packages\numpy\distutils\__init__.py", line 6,
> in <module>
> import ccompiler
> File "C:\Python25\Lib\site-packages\numpy\distutils\ccompiler.py", line 7,
> in <module>
> from distutils import ccompiler
> ImportError: cannot import name ccompiler
> - It's having a problem with ccompiler, but ccompiler.py is on that
> directory.
>
> Thanks in advance for your help.
> Gus
From: John H. <jd...@gm...> - 2009年02月10日 14:05:45
On Tue, Feb 10, 2009 at 7:55 AM, Gerry Steele <ger...@gm...> wrote:
> Thanks Michael ,
>
> I had somehow put myself under the impression i was using he OO
> version of the api but it is much more clear now. Memory issues now
> look better.
There is room for confusion. A common usage pattern, one I often use
myself, is to use pyplot for figure creation, closing and showing
only, and to use the OO API for everything else. To whit:
 import matplotlib.pyplot as plt
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.plot([1,2,3])
 ax.set_xlabel('hi')
 plt.show()
this contrasts with the pure pyplot approach, which uses the pyplot
state machine for everything (figure/axes creation, current axes, etc)
 import matplotlib.pyplot as plt
 plt.plot([1,2,3])
 plt.xlabel('hi')
 plt.show()
and both are different from the pure OO approach in which you manually
create the figure canvas etc
 from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
 from matplotlib.figure import Figure
 fig = Figure()
 canvas = FigureCanvas(fig)
 ax = fig.add_subplot(111)
 ax.plot([1,2,3])
 ax.set_xlabel('hi')
Note that in the 3rd example, all the code is the same as the first
example, except the figure/canvas creation, which is why one might
call it "OO pyplot"
Eric has summarized some additional information about the different
usage modes here
 http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
JDH
From: Gerry S. <ger...@gm...> - 2009年02月10日 13:55:17
Thanks Michael ,
I had somehow put myself under the impression i was using he OO
version of the api but it is much more clear now. Memory issues now
look better.
Thanks.
2009年2月10日 Michael Droettboom <md...@st...>:
> This is an instance of the OP's problem again. Your example is using the
> pyplot (i.e. Matlab-like) interface, in which case, you must explicitly
> close each figure when you're done with it, like follows:
>
> plt.close(fig)
>
> "del fig" only deletes your local reference to the figure. There is still a
> reference being held by the figure manager in case you wanted to go back to
> an earlier figure (accessed by number) and edit it. This is essentially the
> price paid for Matlab-work-a-likeness.
>
> I've tested your script on 0.98.3 (though on a RHEL4 system) and I don't see
> any memory leaks after adding the call to "plt.close(fig)".
>
> If you instantiate the figure and canvas directly (as in the agg_oo.py
> example), you won't have this issue.
>
> Mike
>
> Gerry Steele wrote:
>>>>
>>>> instance of Figure(), then you shouldn't need to close the figure by
>>>> hand.
>>>> It should be deleted whenever you delete or replace your instance of
>>>> Figure. (If I understand correctly.)
>>>>
>>
>>
>>>
>>> ... Garbage collection will take
>>> care of reclaiming memory once the user code has no more references to
>>> the object either.
>>>
>>
>>
>> I guess that is how it should work in theory. However at least for the
>> version of mpl shipped with ubuntu 8.10 (Version: 0.98.3-4ubuntu1)
>> there is surely quite a serious and easily demonstrated memory leak
>> using the artist api. Even if you manually del the figure objects
>> which are created inside a loop a significant growth of memory can be
>> observed. In fact I think there may be two separate leaks.
>>
>> In the attatched standalone code example after 1000 iterations
>> creating 1000 png graphs there is around 2GB of RAM consumed. If you
>> takeout the call to savefig around 600MB is consumed.
>>
>> In my view the code in the loop should execute in constant space
>> without growth at all. Note that when the function returns the memory
>> seems to be deallocated so if you check the ram use during the sleep
>> you should see this.
>>
>> Any ideas on this?
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Create and Deploy Rich Internet Apps outside the browser with
>> Adobe(R)AIR(TM)
>> software. With Adobe AIR, Ajax developers can use existing skills and code
>> to
>> build responsive, highly engaging applications that combine the power of
>> local
>> resources and data with the reach of the web. Download the Adobe AIR SDK
>> and
>> Ajax docs to start building applications
>> today-http://p.sf.net/sfu/adobe-com
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
-- 
Gerry Steele
http://belfast.no-ip.info/
From: Michael D. <md...@st...> - 2009年02月10日 13:25:03
This is an instance of the OP's problem again. Your example is using 
the pyplot (i.e. Matlab-like) interface, in which case, you must 
explicitly close each figure when you're done with it, like follows:
 plt.close(fig)
"del fig" only deletes your local reference to the figure. There is 
still a reference being held by the figure manager in case you wanted to 
go back to an earlier figure (accessed by number) and edit it. This is 
essentially the price paid for Matlab-work-a-likeness.
I've tested your script on 0.98.3 (though on a RHEL4 system) and I don't 
see any memory leaks after adding the call to "plt.close(fig)".
If you instantiate the figure and canvas directly (as in the agg_oo.py 
example), you won't have this issue.
Mike
Gerry Steele wrote:
>>> instance of Figure(), then you shouldn't need to close the figure by hand.
>>> It should be deleted whenever you delete or replace your instance of
>>> Figure. (If I understand correctly.)
>>> 
>
> 
>> ... Garbage collection will take
>> care of reclaiming memory once the user code has no more references to
>> the object either.
>> 
>
>
> I guess that is how it should work in theory. However at least for the
> version of mpl shipped with ubuntu 8.10 (Version: 0.98.3-4ubuntu1)
> there is surely quite a serious and easily demonstrated memory leak
> using the artist api. Even if you manually del the figure objects
> which are created inside a loop a significant growth of memory can be
> observed. In fact I think there may be two separate leaks.
>
> In the attatched standalone code example after 1000 iterations
> creating 1000 png graphs there is around 2GB of RAM consumed. If you
> takeout the call to savefig around 600MB is consumed.
>
> In my view the code in the loop should execute in constant space
> without growth at all. Note that when the function returns the memory
> seems to be deallocated so if you check the ram use during the sleep
> you should see this.
>
> Any ideas on this?
>
>
>
> 
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Stephane R. <ste...@gm...> - 2009年02月10日 13:07:12
Hi Marjolaine,
On Tue, Feb 10, 2009 at 12:31 PM, Marjolaine Rouault <mro...@cs...>wrote:
> Hi,
>
> I am struggling to do a PCA analysis on a masked array. Anybody has
> suggestions on how to deal with masked array when doing PCAs?
You need to remove missing values at each time step.
This means that your missing data are always at the same place.
Maybe something like this can work :
# Let's say we analyse myfullvar(nt,ny,nx)
mask = myfullvar[0]
ns = numpy.count(~mask)
myvar = numpy.zeros(nt,ns)
for it in xrange(nt):
 myvar[it] = myfullvar[it].compressed()
# Then you make a PCA decomposition of myvar and you get back your EOFs
myeofs(neof,ns)
myfulleofs = numpy.ma.zeros(neof,ny,nx)+numpy.ma.masked
for ieof in xrange(neof):
 myfulleofs[~mask.flat] = myeofs[ieof]
>
> Best regards, Marjolaine.
>
>
>
> --
> This message is subject to the CSIR's copyright terms and conditions,
> e-mail legal notice, and implemented Open Document Format (ODF) standard.
> The full disclaimer details can be found at
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean. MailScanner thanks Transtec Computers for
> their support.
>
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Stephane Raynaud
From: Marjolaine R. <mro...@cs...> - 2009年02月10日 12:40:37
Hi,
I am struggling to do a PCA analysis on a masked array. Anybody has suggestions on how to deal with masked array when doing PCAs?
Best regards, Marjolaine.
-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
From: Gerry S. <ger...@gm...> - 2009年02月10日 12:40:36
Attachments: memleaktest.py
>> instance of Figure(), then you shouldn't need to close the figure by hand.
>> It should be deleted whenever you delete or replace your instance of
>> Figure. (If I understand correctly.)
>... Garbage collection will take
> care of reclaiming memory once the user code has no more references to
> the object either.
I guess that is how it should work in theory. However at least for the
version of mpl shipped with ubuntu 8.10 (Version: 0.98.3-4ubuntu1)
there is surely quite a serious and easily demonstrated memory leak
using the artist api. Even if you manually del the figure objects
which are created inside a loop a significant growth of memory can be
observed. In fact I think there may be two separate leaks.
In the attatched standalone code example after 1000 iterations
creating 1000 png graphs there is around 2GB of RAM consumed. If you
takeout the call to savefig around 600MB is consumed.
In my view the code in the loop should execute in constant space
without growth at all. Note that when the function returns the memory
seems to be deallocated so if you check the ram use during the sleep
you should see this.
Any ideas on this?
-- 
Gerry Steele
http://belfast.no-ip.info/
From: C M <cmp...@gm...> - 2009年02月10日 07:46:12
Is it possible to set (and unset) the color of a single point
on a line, or an individual bar in a bar chart?
Thanks,
Che
From: Jouni K. S. <jk...@ik...> - 2009年02月10日 05:59:29
Ryan May <rm...@gm...> writes:
> On Mon, Feb 9, 2009 at 2:37 PM, A B <pyt...@gm...> wrote:
>
> If you're using the full OO interface and creating a figure by making an
> instance of Figure(), then you shouldn't need to close the figure by hand.
> It should be deleted whenever you delete or replace your instance of
> Figure. (If I understand correctly.)
Yes, in the OO interface there is no close() because matplotlib does not
retain any references to the figure object. Garbage collection will take
care of reclaiming memory once the user code has no more references to
the object either.
That said, there have been cases of memory leaks caused by circular
references among objects that have __del__ methods. I think all known
leaks have been fixed, but if I were deploying a long-lived application
that creates lots of figures, I would definitely want to watch its
memory usage in my exact use case.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks

Showing 12 results of 12

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 によって変換されたページ (->オリジナル) /