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

Showing 13 results of 13

From: Eric F. <ef...@ha...> - 2007年03月20日 20:26:46
Attachments: mem_minimal.py
Pellegrini Eric wrote:
> Hi everybody,
> 
> when repeating the following sequence:
> 
> pylab.figure()
> pylab.close()
> 
> the memory used increases like if something remained. Would you have any 
> idea of what is going on ? How to solve this kind of memory leak ?
I have confirmed this with svn on linux (default backend, GtkAgg) using 
the attached script. We are losing about 17k per loop. The usual 
memory leak checker still indicates that things are OK. The difference 
appears to be the backend. The attached script with Agg instead of 
GtkAgg is OK; but with TkAgg it also leaks. It looks like there is 
something in the interactive backend setup that is not getting cleaned 
up by close().
Thanks for pointing it out.
Eric
From: Pellegrini E. <eri...@ya...> - 2007年03月20日 19:09:11
Hi everybody,
 
 when repeating the following sequence:
 
 pylab.figure()
 pylab.close()
 
 the memory used increases like if something remained. Would you have any idea of what is going on ? How to solve this kind of memory leak ?
 
 thank you very much
 
 Eruc 
 		
---------------------------------
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
From: Pellegrini E. <eri...@ya...> - 2007年03月20日 16:20:21
Hi,
 
 I have a problem of memory leak using the following code:
 
 ********************************************************************************
 from Tkinter import *
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
 import pylab
 
 def display():
 mat = pylab.zeros((100,100))
 pylab.ioff()
 image = pylab.matshow(mat)
 pylab.ion()
 pylab.close()
 can = FigureCanvasTkAgg(image, master=frame)
 can.show()
 can.get_tk_widget().grid(row = 0,column = 0)
 
 root = Tk()
 frame = Frame(root)
 frame.grid(row = 0,column = 0)
 canvas = Canvas(frame, width = 240, height = 240, relief = "sunken", bg = "white") 
 canvas.grid()
 button = Button(root,text="DisplayMatrix",command = display)
 button.grid(row = 1,column = 0)
 *******************************************************************************
 
 would you have any idea of what is going wrong ?
 
 Thank you very much
 
 Eric
 
 
 
 
 
 
 
 
 
 
 		
---------------------------------
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
From: Steve S. <el...@gm...> - 2007年03月20日 15:33:26
Ana Paula Leite wrote:
> Dear all,
> 
> I have a list with about 300 elements like the following:
> listNames = ['name1', 'name2', 'name3', ...]
> 
> I want to iterate through this list, creating several figures where each 
> one will include two subplots.
> The problem is that I want to label each figure like in the following 
> example:
> 
> 'name1_name2.png'
> 
> How do I concatenate those names in the savefig() function?
> 
How about
name = "%s_%s.png" %(listNames[0], listNames[1])
savegig(name)
or
name = listNames[0] + "_" + listNames[1] + ".png"
-- 
cheers,
steve
Random number generation is the art of producing pure gibberish as 
quickly as possible.
From: Ana P. L. <apo...@gm...> - 2007年03月20日 15:31:32
It's just as simple as:
savefig('name1'+'_'+'name2')
From: Ana P. L. <apo...@gm...> - 2007年03月20日 15:17:56
Dear all,
I have a list with about 300 elements like the following:
listNames = ['name1', 'name2', 'name3', ...]
I want to iterate through this list, creating several figures where each one
will include two subplots.
The problem is that I want to label each figure like in the following
example:
'name1_name2.png'
How do I concatenate those names in the savefig() function?
Thanks,
Ana
From: Ryan K. <rya...@gm...> - 2007年03月20日 13:49:36
Thanks John. That will work.
Ryan
On 3/20/07, John Hunter <jd...@gm...> wrote:
> On 3/20/07, Ryan Krauss <rya...@gm...> wrote:
> > I have a figure with 2 subplots (2 rows, 1 column) created using the
> > OO interface like this:
> >
> > ax1=fig.add_subplot(2,1,1)
> > ax2=fig.add_subplot(2,1,2)
> >
> > After I have created these axes and plotted things on them, I want to
> > be able to set their x and y lims. The function that creates the plot
> > returns fig. I can then get to a list of the axes from fig.axes. My
> > question is this: can I know from the list of axes or their individual
> > properties which one is which - i.e. which one is the top one and
> > which one is the bottom one? It looks like ax1.rowNum and colNum
> > should refer to the parameters I want (rowNum in this case, since
> > there is only one column). But there isn't a docstring for them. Is
> > this there intended use (or at least a safe use of them)?
> >
> > 99% of the time, I will create the top one first so topfig=fig.axes[0]
> > and bottomfig=fig.axes[1]. But if I ever screw that up, it could be
> > bad.
>
>
> If you are creating subplots, you can do
>
> rows, cols, num = ax.get_geometry()
>
> You can also change the geometry with set_geometry.
>
> There are a couple of Subplot helper functions you may find useful, eg
> to selectively apply x and ylabeling:
>
> def is_first_col(self):
> return self.colNum==0
>
> def is_first_row(self):
> return self.rowNum==0
>
> def is_last_row(self):
> return self.rowNum==self.numRows-1
>
> def is_last_col(self):
> return self.colNum==self.numCols-1
>
From: John H. <jd...@gm...> - 2007年03月20日 13:35:59
On 3/20/07, Ryan Krauss <rya...@gm...> wrote:
> I have a figure with 2 subplots (2 rows, 1 column) created using the
> OO interface like this:
>
> ax1=fig.add_subplot(2,1,1)
> ax2=fig.add_subplot(2,1,2)
>
> After I have created these axes and plotted things on them, I want to
> be able to set their x and y lims. The function that creates the plot
> returns fig. I can then get to a list of the axes from fig.axes. My
> question is this: can I know from the list of axes or their individual
> properties which one is which - i.e. which one is the top one and
> which one is the bottom one? It looks like ax1.rowNum and colNum
> should refer to the parameters I want (rowNum in this case, since
> there is only one column). But there isn't a docstring for them. Is
> this there intended use (or at least a safe use of them)?
>
> 99% of the time, I will create the top one first so topfig=fig.axes[0]
> and bottomfig=fig.axes[1]. But if I ever screw that up, it could be
> bad.
If you are creating subplots, you can do
rows, cols, num = ax.get_geometry()
You can also change the geometry with set_geometry.
There are a couple of Subplot helper functions you may find useful, eg
to selectively apply x and ylabeling:
 def is_first_col(self):
 return self.colNum==0
 def is_first_row(self):
 return self.rowNum==0
 def is_last_row(self):
 return self.rowNum==self.numRows-1
 def is_last_col(self):
 return self.colNum==self.numCols-1
From: Ryan K. <rya...@gm...> - 2007年03月20日 12:59:20
I have a figure with 2 subplots (2 rows, 1 column) created using the
OO interface like this:
ax1=fig.add_subplot(2,1,1)
ax2=fig.add_subplot(2,1,2)
After I have created these axes and plotted things on them, I want to
be able to set their x and y lims. The function that creates the plot
returns fig. I can then get to a list of the axes from fig.axes. My
question is this: can I know from the list of axes or their individual
properties which one is which - i.e. which one is the top one and
which one is the bottom one? It looks like ax1.rowNum and colNum
should refer to the parameters I want (rowNum in this case, since
there is only one column). But there isn't a docstring for them. Is
this there intended use (or at least a safe use of them)?
99% of the time, I will create the top one first so topfig=fig.axes[0]
and bottomfig=fig.axes[1]. But if I ever screw that up, it could be
bad.
Thanks,
Ryan
From: David S. <dav...@me...> - 2007年03月20日 12:38:40
Hi!
I'm trying to do a few plots in one figure using subplot, but the
size of the legends isn't changing as I try to add more plots.
I have found out how to change the size the hard-coded way, but
is there any way I can get the legend to know how large it should
be? For example, with the following test code the legend is
fine with 2 rows of figures, but massive for 5 rows:
y=([ 1.2, 2.3, 3.4, 2.2 ])
z=([ 2.2, 2.6, 1.4, 1.2 ])
a1=subplot(541)
plot( y, label='TESTY' )
a1.legend()
a2=subplot(542)
plot( z, label='TESTZ' )
a2.legend()
show()
Thanks for any tips,
Dave
~
From: Fernando P. <fpe...@gm...> - 2007年03月20日 06:52:42
On 3/19/07, Eric Firing <ef...@ha...> wrote:
> One of the matshow anomalies is that it is a pylab function only instead
> of a wrapper for an Axes method, so I made a new Axes.matshow(), and a
> temporary matshow1() pylab function that calls it. Differences between
> matshow() and matshow1():
>
> 1) The latter labels the *centers* of the squares representing the
> matrix elements, starting from zero. Tick values are consequently integers.
>
> 2) matshow1 uses the same function as matshow (figaspect()) to determine
> the window dimensions, but keeps the matrix elements square when they
> would be stretched in matshow. I can change this back to the matshow
> behavior if desired.
Sounds good to me.
> > All I need regularly in my work is the ability to plot a matrix such
> > that both the axis AND the enclosing figure (which determines the size
> > of the resulting EPS files for publications or talks) have the aspect
> > ratio of the actual matrix. How that result is achieved is really
> > immaterial to me.
>
> I suspect that what you would actually prefer is better automated figure
> sizing so that it would always nicely enclose the axes with their
> labels, titles, etc., correct? There is nothing magic about having the
> actual aspect ratio of the figure exactly match that of the axes box?
> (Not that I can easily achieve the nice wrapping result--this is just to
> clarify the ideal.)
Yes. In fact, others have pointed the annoying mis-feature of
old-matshow where the figure is squeezed if you add for example a
colorbar.
> > matshow does what I need so I use it, but I have no particular
> > attachment to the code other than the fact that it happens to work
> > correctly. That's a bonus in my book.
>
> Absolutely!
>
> Another anomaly of matshow (presently preserved in matshow1) is the
> returnall kwarg; this seems like the sort of thing that should either be
> supported by all pylab functions, or by none. The argument for none is
> that one can easily use gcf() and gca() to get the other two arguments.
> Do you want to keep the returnall kwarg?
I honestly don't remember clearly why that was put in. John and I had
some brief discussion about it, but in practice I don't think I've
ever actually used it. So follow your judgment on this one, I have no
opinion.
Keep in mind that I wrote matshow() strictly as a quick hack to get
some functionality I needed badly (properly scaled display of matrices
with labeling along the top/left like 'normal' matrices). I knew so
little about the internals of mpl that it's no surprise the code has
problems, so by all means feel free to improve it and modify it so it
actually fits better with the overall architecture. I'm sure we'll
all benefit from such a cleanup.
Cheers,
f
From: lazardo <mas...@ya...> - 2007年03月20日 02:08:56
I'm curious .. how can we include a scrollbar with a subplot, instead of the back and front arrows to view the subplot. Googling matplotlib+scrollbar+subplot brings up a very few results, so I guess it hasn't been attempted before.
 
 Any ideas ? 
 
 Thanx.
 iyer
 
 
---------------------------------
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
From: Ryan K. <rya...@gm...> - 2007年03月20日 00:15:30
Thanks to Ken and John, I think I am off and running. Nice work on
wxmpl Ken! I think it fills a significant need.
The two attached files show a ridiculously simple example of what I am
planning to do. It may be completely obvoius to others. test_plot.py
is an example of a module that can be used from the command line with
pylab and IPython and it can also be imported into a WX app (as
demonstrated by wx_compatible.py). So, I will edit my data processing
scripts to use this approach.
Thanks again,
Ryan
On 3/19/07, Ryan Krauss <rya...@gm...> wrote:
> Sorry, I just googled wxmpl and found your page and am now downloading
> it. I may have a more intelligent question momentarily. You may
> ignore that part of my response.
>
> Ryan
>
> On 3/19/07, Ryan Krauss <rya...@gm...> wrote:
> > Thanks for your thoughts Ken. Sorry, I assumed a bit on the context
> > of my comments. I have some data processing utility scripts and I
> > want to now use with a WX application. The problem is that the
> > utility modules were written without any thought of this future use in
> > mind and in all of them I have something like
> >
> > from pylab import figure, cla, clf, plot, semiliogx, show, ...
> >
> > at the top. This makes them completely incompatible with embedding in
> > a WX application. So, I need to re-write them and I want to know how
> > to do that best. John had some suggestions and I had some new
> > questions as I tried to act on his thoughts. So, the actual plotting
> > functions don't have to be re-useable in both contexts, but it would
> > be nice.
> >
> > I can't actually run your code because I don't have the wxmpl.py
> > module. Looking at it, it looks like a really nice set of functions
> > that work cleanly with embedding in a backend. How could I call one
> > of the functions from the command line? Could I do something like:
> > import plotting, pylab
> > myfig = pylab.figure()
> > plotting.plot_simple(myfig)
> >
> > and would I need any additional commands to actually show the figure?
> >
> > Let me know if that makes sense and please send me the wxmpl.py file
> > or let me know where I can get it.
> >
> > Thanks again,
> >
> > Ryan
> >
> > On 3/19/07, Ken McIvor <mc...@ii...> wrote:
> > > Ryan,
> > >
> > > In my (limited) experience, it's dicey to mix pylab's plotting
> > > functionality and the OO API. I guess I'm a little unclear exactly
> > > what your use case is for this. It sounds like you're goal is to
> > > create a library of functions that operate on Figure instances,
> > > perhaps so you can use them both interactively and as part of a
> > > wxPython application.
> > >
> > > If that's the case, I'd recommend you try using pylab's gcf() and draw
> > > () to acquire and redraw the current Figure instance from within
> > > IPython. You can also save the return value of pylab's figure(),
> > > which returns a Figure that's already been attached to the
> > > appropriate renderer. This way you can use the OO API for plotting
> > > without having to futz with the drawing machinery directly.
> > >
> > > This script might give you some ideas about how to structure your
> > > code. It contains several of the MPL examples re-coded as functions
> > > that accept a Figure instance and use the OO API for plotting.
> > >
> > > http://svn.csrri.iit.edu/mr-software/wxmpl/trunk/demos/plotting.py
> > >
> > > Ken
> > >
> >
>

Showing 13 results of 13

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