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



Showing results of 165

<< < 1 2 3 4 5 6 7 > >> (Page 4 of 7)
From: Robert K. <rob...@gm...> - 2006年05月19日 16:27:30
John Hunter wrote:
>>>>>>"Géza" == Géza Groma <gr...@nu...> writes:
> 
> Géza> Is there any other solution better then modifying two
> Géza> modules of separate packages?
> 
> Probably not -- numpy should probably remove this -- you might want to
> email their list.
Building extensions for 2.4 with Mingw is not 100% reliable no matter how it's
done. Mingw has been written to use MSVCRT.dll as its C runtime. Python 2.4 uses
MSVCR71.dll as its C runtime. If you leave out the 'msvcr71' library and use an
out-of-box Mingw installation, then you will get two different C runtimes. If a
FILE pointer passes between them (or any other structure provided by the C
runtime), you will crash the interpreter. However, the headers for Mingw have
been written against MSVCRT.dll and reference things not present in MSVCR71.dll
(in this case _ctype, a jump table used by isalpha() and friends IIRC).
There is currently no general solution that will work for all extensions. The
only general solution is to modify Mingw to use MSVCR71.dll as its runtime. But
no one seems to be working on that.
-- 
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: John H. <jdh...@ac...> - 2006年05月19日 15:43:41
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes:
 Eric> great! a quick one then: how would you then do to have a
 Eric> marker symbols where some part of the polygon is not
 Eric> attached to the rest (a vertical line plus an ellipse for
 Eric> example). I could do that using two different markers and
 Eric> plotting them one after the other, but is there a simpler
 Eric> way? thanks Eric
Just use the brute force approach for now, and when I get some time
I'll look into generalizing this for general paths.
JDH
From: Eric E. <ems...@ob...> - 2006年05月19日 15:20:11
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
 <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
great!<br>
<br>
a quick one then: how would you then do to have a marker symbols where
some part of the polygon is not attached to the rest (a vertical line
plus an ellipse for example). I could do that using two different
markers and plotting them one after the other, but is there a simpler
way?<br>
<br>
thanks<br>
Eric<br>
<br>
John Hunter wrote:
<blockquote cite="mid...@pe..."
 type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <pre wrap="">"Eric" == Eric Emsellem <a class="moz-txt-link-rfc2396E" href="mailto:ems...@ob...">&lt;ems...@ob...&gt;</a> writes:
 </pre>
 </blockquote>
 </blockquote>
 </blockquote>
 </blockquote>
 </blockquote>
 <pre wrap=""><!---->
 Eric&gt; Hi again, I am trying to see if I could produce a scatter
 Eric&gt; plot (using "scatter" or "plot") but using NEW symbols (so
 Eric&gt; not already available in the list provided). I would like to
 Eric&gt; design new symbols (in some way which is to be defined) so
 Eric&gt; that scatter and/or plot would be able to use them.
 Eric&gt; Examples: horizontal or vertical or even rotated ellipses,
 Eric&gt; icon sketched galaxy-looking symbols, ...
 Eric&gt; Any hint on how to do this?
 Eric&gt; thanks in advance for any help here!
 Eric&gt; Eric P.S.: I already posted a similar question a few days
 Eric&gt; ago, so forgive me for this repetition...
persistence wins the day!
I added an option to scatter to support custom markers. You pass in a
list if x,y vertices for the polygon you want to use as the marker.
I haven't quite worked out the scaling yet, so for now use scale
arguments that look right and understand that this may change when we
get the scaling issue cleaned up.
I added an example to svn revision 2402
examples/scatter_custom_symbol.py. Here it is, using an ellipse
 from pylab import figure, nx, show
 # unit area ellipse
 rx, ry = 3., 1.
 area = rx * ry * nx.pi
 theta = nx.arange(0, 2*nx.pi+0.01, 0.1)
 verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta))
 x,y,s,c = nx.rand(4, 30)
 s*= 10**2. 
 fig = figure()
 ax = fig.add_subplot(111)
 ax.scatter(x,y,s,c,marker=None,verts =verts)
 show()
One thing we can do to make this more user friendly is to add new
symbols to the scatter symbol table, eg
'wellipse' : a wide ellipse
'tellipse' : a tall ellipse
and map names to sequences of vertices. So as you create the custom
symbols you want to use, send them to me and I'll add them to the
defaults, where appropriate.
Cheers,
JDH
 </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
====================================================================
Eric Emsellem <a class="moz-txt-link-abbreviated" href="mailto:ems...@ob...">ems...@ob...</a>
 Centre de Recherche Astrophysique de Lyon
9 av. Charles-Andre tel: +33 (0)4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 (0)4 78 86 83 86
France <a class="moz-txt-link-freetext" href="http://www-obs.univ-lyon1.fr/eric.emsellem">http://www-obs.univ-lyon1.fr/eric.emsellem</a>
====================================================================
</pre>
</body>
</html>
From: John H. <jdh...@ac...> - 2006年05月19日 14:16:02
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes:
 Eric> Hi again, I am trying to see if I could produce a scatter
 Eric> plot (using "scatter" or "plot") but using NEW symbols (so
 Eric> not already available in the list provided). I would like to
 Eric> design new symbols (in some way which is to be defined) so
 Eric> that scatter and/or plot would be able to use them.
 Eric> Examples: horizontal or vertical or even rotated ellipses,
 Eric> icon sketched galaxy-looking symbols, ...
 Eric> Any hint on how to do this?
 Eric> thanks in advance for any help here!
 Eric> Eric P.S.: I already posted a similar question a few days
 Eric> ago, so forgive me for this repetition...
persistence wins the day!
I added an option to scatter to support custom markers. You pass in a
list if x,y vertices for the polygon you want to use as the marker.
I haven't quite worked out the scaling yet, so for now use scale
arguments that look right and understand that this may change when we
get the scaling issue cleaned up.
I added an example to svn revision 2402
examples/scatter_custom_symbol.py. Here it is, using an ellipse
 from pylab import figure, nx, show
 # unit area ellipse
 rx, ry = 3., 1.
 area = rx * ry * nx.pi
 theta = nx.arange(0, 2*nx.pi+0.01, 0.1)
 verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta))
 x,y,s,c = nx.rand(4, 30)
 s*= 10**2. 
 fig = figure()
 ax = fig.add_subplot(111)
 ax.scatter(x,y,s,c,marker=None,verts =verts)
 show()
One thing we can do to make this more user friendly is to add new
symbols to the scatter symbol table, eg
'wellipse' : a wide ellipse
'tellipse' : a tall ellipse
and map names to sequences of vertices. So as you create the custom
symbols you want to use, send them to me and I'll add them to the
defaults, where appropriate.
Cheers,
JDH
From: John H. <jdh...@ac...> - 2006年05月19日 13:57:37
>>>>> "G=E9za" =3D=3D G=E9za Groma <gr...@nu...> write=
s:
 G=E9za> Is there any other solution better then modifying two
 G=E9za> modules of separate packages?
Probably not -- numpy should probably remove this -- you might want to
email their list.
JDH
From: <gr...@nu...> - 2006年05月19日 12:38:04
I tried to install matplotlib from svn (2398) on a system of
WindowsXP, python-2.4.2, numpy-0.9.6r1, MinGW-5.0.2. Even applying the
hack described in
http://mail.python.org/pipermail/python-list/2004-December/254826.html,
running
from pylab import *
caused the error message
the procedure entry point _ctype could not be located in the dynamic
link libary msvcr71.dll
I realized that matplotib relies on the distutils package of numpy
which in turn has its own mingw32ccompiler.py module and found that
the problem can be cured by commenting out the following lines in
Mingw32CCompiler.link
 if sys.version[:3] > '2.3':
 if libraries:
 libraries.append('msvcr71')
 else:
 libraries =3D ['msvcr71']
Is there any other solution better then modifying two modules of
separate packages?
Regargs,
G=E9za Groma
Institute of Biophysics
Biological Research Center of the Hungarian Academy of Sciences
Temesv=E1ri krt. 62.
6701 Szeged, Hungary
phone: +36 62 599 620 fax: +36 62 433 133 cellular: +36 20 5648 303
From: Eric E. <ems...@ob...> - 2006年05月19日 10:12:22
Hi again,
I am trying to see if I could produce a scatter plot (using "scatter" or 
"plot") but using NEW symbols (so not already available in the list 
provided). I would like to design new symbols (in some way which is to 
be defined) so that scatter and/or plot would be able to use them.
Examples: horizontal or vertical or even rotated ellipses, icon sketched 
galaxy-looking symbols, ...
Any hint on how to do this?
thanks in advance for any help here!
Eric
P.S.: I already posted a similar question a few days ago, so forgive me 
for this repetition...
-- 
====================================================================
Eric Emsellem ems...@ob...
 Centre de Recherche Astrophysique de Lyon
9 av. Charles-Andre tel: +33 (0)4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 (0)4 78 86 83 86
France http://www-obs.univ-lyon1.fr/eric.emsellem
====================================================================
From: Eric F. <ef...@ha...> - 2006年05月19日 07:37:41
I have added examples/multi_image.py to svn in response to Marcel 
Oliver's question. In the process, I found and fixed a bug in the new 
colorbar (also only in svn); now the ticks are labelled with the order 
of magnitude when the colors are mapped to very small or very large 
numbers, in the same way as they are for any other axes object.
Eric
From: Graeme O'K. <gj...@ne...> - 2006年05月19日 07:04:31
Hi,
I think I have a Mac OS X specific problem using 'ipython -pylab'
I have some pylab plotting that updates for every event on ubuntu 
with the wxpython backend.
However, the same code on OS X does not update until the final 
pylab.show().
However, when I enter a series of plot commands from the ipython 
prompt, they update fine.
I'm presuming it's some kind of threading problem, so my question is; 
is there a way to explicitly give app.mainloop() or whatever some 
oxygen?
Here's the example code which updates each plot separately as 
expected/desired under ubuntu +python2.4 + wxPython2.6 + ipython 
0.6.x, matplotlib-0.86.2
Under Mac OS 10.4 + python 2.4.1 + wxpython2.6 + ipython 0.7.1.fix1 
(didn't work for ipython 0.6.x either) + matplotlib-0.86.2cvs-py2.4- 
macosx-10.4-ppc.egg, the update does not occur until the pylab.show() 
statement is reached (and yes, I tried replacing the draw with show, 
no difference).
It was a lot faster when I removed the pylab.draw() statement, so the 
rendering would seem to be taking place, it just doesn't make it to 
the physical screen.
Have any other Mac OS X users experienced this? Any suggestions?
regards,
Graeme
% ipython -pylab
In [1]:import interactive as i
In [2]:i.main()
isinteractive() = True
here is interactive.py
#!/usr/bin/env python
#
# ipython -pylab
# In [1]: import interactive as i
# In [2]: i.main()
#
import pylab, numpy
class data :
 def __init__(self, N) :
 self.n = 0
 self.N = N
 self.t = numpy.arange(0.0, 2*numpy.pi, numpy.pi / 64)
 #end
 def read(self) :
 self.n += 1
 self.y = numpy.sin(self.t) + numpy.randn(len(self.t))/10.0
 if self.n >= self.N : return False
 else : return True
 #end
#end
def main(N = 100) :
 print 'isinteractive() = ', pylab.interactive()
 d = data(N)
 f = pylab.figure()
 a = f.add_subplot(1,1,1)
 cols = 'rgbcmyk'
 n = 0
 while d.read() :
# a.hold(False)
 a.plot(d.t, d.y, cols[n % len(cols)])
 a.grid(True)
 pylab.draw()
 n += 1
 #end
 pylab.show()
#end
if __name__ == '__main__' :
 main(10)
#end
From: John H. <jdh...@ac...> - 2006年05月19日 02:52:10
>>>>> "Joseph" == <jo...@3t...> writes:
 Joseph> Hi,
 Joseph> I'm plotting y values which exceed 10000. I would like the
 Joseph> y axis labels to be formatted as whole numbers such as
 Joseph> 10000, not in scientific notation such as 1.0e4, with the
 Joseph> exponent appearing up at the top left corner. This occurs
 Joseph> if I plot something like:
 Joseph> from pylab import * y = (1000,9000,14000) plot(y) show()
 Joseph> I've looked around the docs and source a bit, but haven't
 Joseph> found the love yet. I'm running version 0.86.2. \
See the chapter in the user's guide on tick labeling and formatting.
The code below is freestyle and untested, so may contain minor bugs,
but here is the idea
from matplotlib.ticker import ScalarFormatter
ax = subplot(111)
ax.plot(something)
ax.yaxis.set_major_formatter(ScalarFormatter())
Darren: some pylab functionality with a dead-simple interface would be
nice here, something that let us say something like
 yticks(formatter='scalar')
and so on to select the formatter or the locator....
JDH
From: <jo...@3t...> - 2006年05月19日 01:01:55
Hi,
I'm plotting y values which exceed 10000. I would like the y axis
labels to be formatted as whole numbers such as 10000, not in scientific 
notation such as 1.0e4, with the exponent appearing up at the top left corner. 
This occurs if I plot something like:
from pylab import *
y = (1000,9000,14000)
plot(y)
show()
I've looked around the docs and source a bit, but haven't found the love
yet. I'm running version 0.86.2. Any help would be appreciated. Thanks!
Joseph Sheedy
Technical Specialist, 3TIER Environmental Forecast Group
jo...@3t... | (206)325-1573 x116
From: John H. <jdh...@ac...> - 2006年05月18日 22:28:17
>>>>> "Frederic" == Frederic Back <fre...@gm...> writes:
 Frederic> On Thu, 2006年05月18日 at 15:57 -0500, John Hunter wrote:
 >> You can comment out the code in backends/backend_gtk.py
 Frederic> Well, this seems like a bug to me, then. Matplotlib
 Frederic> offers the possibility to draw to a file instead of
 Frederic> opening a window. In this case, the default window icon
 Frederic> should *not* get overridden.
FYI, if all you are using matplotlib for is to write to a file, you
can just use the Agg backend (or PS or SVG or whatever) and GTK will
never be imported and the icon won't be touched. 
As an aside, if you are writing a GTK plugin you probably shouldn't be
using pylab at all, but rather the OO classes directly, as in
examples/embedding_in_gtk*.py.
 Frederic> The best way to patch this would be to set the default
 Frederic> window icon only when the gtk main loop is entered.
 Frederic> I attached a patch against the current SVN. It simply
 Frederic> moves the window icon declaration just before the line
 Frederic> where gtk.main() gets called.
I don't think this is the right place to put the patch -- "show" is
for pylab only, and it may be that application developers (me for one)
who won't be using pylab or calling show (they'll start the mainloop
themselves) and who like the icon for their mpl figures. I agree that
always overriding the icon when import backend_gtk is a bit heavy
handed, though. I hate to suggest another rc param, but we could have
gtk.icon : matplotlib.svg # use None to suppress the default
 # minimization icon or an svg file to 
 # provide your own 
any better ideas?
JDH
From: Frederic B. <fre...@gm...> - 2006年05月18日 21:39:26
Attachments: backend_gtk.py.patch
On Thu, 2006年05月18日 at 15:57 -0500, John Hunter wrote:
> You can comment out the code in backends/backend_gtk.py
Well, this seems like a bug to me, then. Matplotlib offers the
possibility to draw to a file instead of opening a window. In this case,
the default window icon should *not* get overridden.
The best way to patch this would be to set the default window icon only
when the gtk main loop is entered.
I attached a patch against the current SVN. It simply moves the window
icon declaration just before the line where gtk.main() gets called.
Should I file a bug somewhere? Or does the patch reach the devs here?
Thanks in advance,
Fred
From: John H. <jdh...@ac...> - 2006年05月18日 21:03:06
>>>>> "Frederic" == Frederic Back <fre...@gm...> writes:
 Frederic> Hello, I'm developing a plugin in pygtk, which
 Frederic> indirectly (via networkx) uses matplotlib to display
 Frederic> graphs.
 Frederic> Now, I have the following problem: When I import pylab,
 Frederic> my window icon (the small icon in the window decoration)
 Frederic> gets replaced by the matplotlib icon. I pasted a sample
 Frederic> script below to illustrate.
 Frederic> This is amazingly annoying for me since I am merely
 Frederic> writing a plugin for an existing application and cannot
 Frederic> simply replace the original window icon.
 Frederic> Is there any way to supress this behaviour?
You can comment out the code in backends/backend_gtk.py
try:
 gtk.window_set_default_icon_from_file (
 os.path.join (matplotlib.rcParams['datapath'], 'matplotlib.svg'))
except:
 verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])
or physically remove the icon in which case you'll just get a report
that it is missing. 
You can also set the icon yourself after import matplotlib/backend_gtk
using the same code.
From: Frederic B. <fre...@gm...> - 2006年05月18日 20:52:06
Hello,
I'm developing a plugin in pygtk, which indirectly (via networkx) uses
matplotlib to display graphs.
Now, I have the following problem: When I import pylab, my window icon
(the small icon in the window decoration) gets replaced by the
matplotlib icon. I pasted a sample script below to illustrate. 
This is amazingly annoying for me since I am merely writing a plugin for
an existing application and cannot simply replace the original window
icon.
Is there any way to supress this behaviour?
Please help me, and thanks in advance,
Fred
# ------------------------------------- sample code below
#!/usr/bin/python
import gtk
import pylab
w = gtk.Window()
b = gtk.Button("click me")
w.add(b)
w.show_all()
gtk.main()
From: John H. <jdh...@ac...> - 2006年05月18日 14:08:46
>>>>> "Ryan" == Ryan Krauss <rya...@gm...> writes:
 Ryan> There is a serious flaw to my approach. It seems that if
 Ryan> plot is called with an explicit linetype like 'b-', then
 Ryan> ax._get_lines.count is not automatically incremented.
You should never use an underscore variable since the leading
underscore basically indicates this is an internal variable and it
could be removed or changes at any point w/o documentation. If
something changes in the "public" API, it will at least be documented
in the API_CHANGES file.
I think your best approach is to write some helper classes rather than
try and set the matplotlib defaults
 from mycyclers import colorcycler, linecycler
 for data in mydata:
 ax.plot(data, linestyle=linecycler(), color=colorcycler())
where linecycler and colorcycler are generators of some sort. Rhen
you can alter your linecycler and colorcycler to do whatever you want,
make different defaults for color or grayscale, etc...
I'm not opposed to making the default linestyles and colorcycles
configurable, it has come up a few times, but it may be easier and
quicker for you just to code up some custom classes or functions that
have just the behavior you want. 
JDH
From: Ryan K. <rya...@gm...> - 2006年05月18日 13:20:24
However, calling plot with color and linestyle keyword args instead of
'b-' in args leads to incrementing the line count, and things seem to
be working. (I had actually written a little line count incrementing
function and then had to take it out when I wanted to specify rgb
values and switched to the kwargs).
Ryan
On 5/18/06, Ryan Krauss <rya...@gm...> wrote:
> There is a serious flaw to my approach. It seems that if plot is
> called with an explicit linetype like 'b-', then ax._get_lines.count
> is not automatically incremented.
>
> Ryan
>
> On 5/18/06, Ryan Krauss <rya...@gm...> wrote:
> > Thanks Jouni.
> >
> > I can modify the color order using gca() and _getlines.colors, as you
> > mentioned. But if I can't specify the line type in a similar fashion,
> > then this approach isn't going to work for me.
> >
> > The trick with the other approach (with a global counter for how many
> > lines are on the plot), is how to reset the counter for each new plot.
> > gca()._get_lines.count seems to handle this problem by counting the
> > lines already on the axis. (I wouldn't have known to poke around
> > there if you had got me started.)
> >
> > So, unless a cleaner approach is suggested by someone else, I am going
> > to follow an approach similar to Jouni's suggestion, only using
> > gca()._get_lines.count+1 as the index to my global colors and line
> > types list so that I am always calling plot (or actually semilogx)
> > with explicit linetype specifications (like 'y-','b--',...)
> >
> > Any better ideas?
> >
> > Ryan
> >
> > On 5/18/06, Jouni K Seppanen <jk...@ik...> wrote:
> > > "Ryan Krauss" <rya...@gm...> writes:
> > >
> > > > How do I change the default color order
> > >
> > > The colors are hardwired in the pylab interface, but you can hack
> > > around it:
> > >
> > > gca()._get_lines.colors = ['#101050', '#105010', '#501010']
> > > gca()._get_lines.Ncolors = 3
> > > gca()._get_lines.firstColor = '#101050'
> > >
> > > Support for this might be a useful addition to the pylab interface.
> > > Does anyone know how to do this in Matlab?
> > >
> > > > and how do I set up a similar default linetype order, so that the
> > > > first call to plot generates a solid line and the second a dashed
> > > > one (for example).
> > >
> > > I don't think there is support for this in pylab.
> > >
> > > Of course, if all your plot calls just draw a single line, you can
> > > cycle both the color and the line style easily by defining your own
> > > function:
> > >
> > > my_colors = ['b','g','r']; my_styles = ['-', ':', '--']
> > > my_c = 0; my_s = 0
> > > def plot(x, y):
> > > global my_colors, my_styles, my_c, my_s
> > > pylab.plot(x, y, my_colors[my_c % len(my_colors)]
> > > + my_styles[my_s % len(my_styles)])
> > > my_c += 1; my_s += 1
> > >
> > > But if you want the full pylab.plot argument parsing functionality,
> > > the easiest thing would probably be to implement this in
> > > matplotlib.axis.
> > >
> > > --
> > > Jouni
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Matplotlib-users mailing list
> > > Mat...@li...
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> >
>
From: Ryan K. <rya...@gm...> - 2006年05月18日 12:49:11
There is a serious flaw to my approach. It seems that if plot is
called with an explicit linetype like 'b-', then ax._get_lines.count
is not automatically incremented.
Ryan
On 5/18/06, Ryan Krauss <rya...@gm...> wrote:
> Thanks Jouni.
>
> I can modify the color order using gca() and _getlines.colors, as you
> mentioned. But if I can't specify the line type in a similar fashion,
> then this approach isn't going to work for me.
>
> The trick with the other approach (with a global counter for how many
> lines are on the plot), is how to reset the counter for each new plot.
> gca()._get_lines.count seems to handle this problem by counting the
> lines already on the axis. (I wouldn't have known to poke around
> there if you had got me started.)
>
> So, unless a cleaner approach is suggested by someone else, I am going
> to follow an approach similar to Jouni's suggestion, only using
> gca()._get_lines.count+1 as the index to my global colors and line
> types list so that I am always calling plot (or actually semilogx)
> with explicit linetype specifications (like 'y-','b--',...)
>
> Any better ideas?
>
> Ryan
>
> On 5/18/06, Jouni K Seppanen <jk...@ik...> wrote:
> > "Ryan Krauss" <rya...@gm...> writes:
> >
> > > How do I change the default color order
> >
> > The colors are hardwired in the pylab interface, but you can hack
> > around it:
> >
> > gca()._get_lines.colors = ['#101050', '#105010', '#501010']
> > gca()._get_lines.Ncolors = 3
> > gca()._get_lines.firstColor = '#101050'
> >
> > Support for this might be a useful addition to the pylab interface.
> > Does anyone know how to do this in Matlab?
> >
> > > and how do I set up a similar default linetype order, so that the
> > > first call to plot generates a solid line and the second a dashed
> > > one (for example).
> >
> > I don't think there is support for this in pylab.
> >
> > Of course, if all your plot calls just draw a single line, you can
> > cycle both the color and the line style easily by defining your own
> > function:
> >
> > my_colors = ['b','g','r']; my_styles = ['-', ':', '--']
> > my_c = 0; my_s = 0
> > def plot(x, y):
> > global my_colors, my_styles, my_c, my_s
> > pylab.plot(x, y, my_colors[my_c % len(my_colors)]
> > + my_styles[my_s % len(my_styles)])
> > my_c += 1; my_s += 1
> >
> > But if you want the full pylab.plot argument parsing functionality,
> > the easiest thing would probably be to implement this in
> > matplotlib.axis.
> >
> > --
> > Jouni
> >
> >
> >
> > -------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
From: Ryan K. <rya...@gm...> - 2006年05月18日 12:23:31
Thanks Jouni.
I can modify the color order using gca() and _getlines.colors, as you
mentioned. But if I can't specify the line type in a similar fashion,
then this approach isn't going to work for me.
The trick with the other approach (with a global counter for how many
lines are on the plot), is how to reset the counter for each new plot.
 gca()._get_lines.count seems to handle this problem by counting the
lines already on the axis. (I wouldn't have known to poke around
there if you had got me started.)
So, unless a cleaner approach is suggested by someone else, I am going
to follow an approach similar to Jouni's suggestion, only using
gca()._get_lines.count+1 as the index to my global colors and line
types list so that I am always calling plot (or actually semilogx)
with explicit linetype specifications (like 'y-','b--',...)
Any better ideas?
Ryan
On 5/18/06, Jouni K Seppanen <jk...@ik...> wrote:
> "Ryan Krauss" <rya...@gm...> writes:
>
> > How do I change the default color order
>
> The colors are hardwired in the pylab interface, but you can hack
> around it:
>
> gca()._get_lines.colors = ['#101050', '#105010', '#501010']
> gca()._get_lines.Ncolors = 3
> gca()._get_lines.firstColor = '#101050'
>
> Support for this might be a useful addition to the pylab interface.
> Does anyone know how to do this in Matlab?
>
> > and how do I set up a similar default linetype order, so that the
> > first call to plot generates a solid line and the second a dashed
> > one (for example).
>
> I don't think there is support for this in pylab.
>
> Of course, if all your plot calls just draw a single line, you can
> cycle both the color and the line style easily by defining your own
> function:
>
> my_colors = ['b','g','r']; my_styles = ['-', ':', '--']
> my_c = 0; my_s = 0
> def plot(x, y):
> global my_colors, my_styles, my_c, my_s
> pylab.plot(x, y, my_colors[my_c % len(my_colors)]
> + my_styles[my_s % len(my_styles)])
> my_c += 1; my_s += 1
>
> But if you want the full pylab.plot argument parsing functionality,
> the easiest thing would probably be to implement this in
> matplotlib.axis.
>
> --
> Jouni
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jouni K S. <jk...@ik...> - 2006年05月18日 07:18:34
"Ryan Krauss" <rya...@gm...> writes:
> How do I change the default color order 
The colors are hardwired in the pylab interface, but you can hack
around it:
 gca()._get_lines.colors = ['#101050', '#105010', '#501010']
 gca()._get_lines.Ncolors = 3
 gca()._get_lines.firstColor = '#101050'
Support for this might be a useful addition to the pylab interface. 
Does anyone know how to do this in Matlab?
> and how do I set up a similar default linetype order, so that the
> first call to plot generates a solid line and the second a dashed
> one (for example).
I don't think there is support for this in pylab.
Of course, if all your plot calls just draw a single line, you can
cycle both the color and the line style easily by defining your own
function:
 my_colors = ['b','g','r']; my_styles = ['-', ':', '--']
 my_c = 0; my_s = 0
 def plot(x, y):
 global my_colors, my_styles, my_c, my_s
 pylab.plot(x, y, my_colors[my_c % len(my_colors)]
 + my_styles[my_s % len(my_styles)])
 my_c += 1; my_s += 1
But if you want the full pylab.plot argument parsing functionality,
the easiest thing would probably be to implement this in
matplotlib.axis.
-- 
Jouni
From: Eric F. <ef...@ha...> - 2006年05月18日 01:50:23
Attachments: multi_image.py
Marcel,
It sounds like you want something like the attached example. It works 
on my system based on svn and I expect it will work on a recent official 
release, but I haven't tried it.
Marcel Oliver wrote:
> Hi, I have a plot which is divided into 3x3 subplots, each of
> which is generated by imshow. I now want to do the following
> and have difficulties finding the appropriate documentation:
> 
> 1. Display a single title for the entire plot. title() will either
> have no effect or attach the title to a separate subplot.
> 
> 2. Have the same color scale on each subplot. Is it possible to
> use automatic scaling?
> 
> 3. Attach a single colorbar to the entire plot, rather than
> 9 identical scales to each subplot.
> 
> 4. Have the labeling of the colorbar use the scientific
> number format. I sometimes have rather small values,
> and colorbar() will display 0.0 throughout the scale.
This part depends on whether you are using svn, which as of this week 
has a new colorbar, or an earlier mpl release, with the original 
colorbar. With either you can set the format string: for example, use 
tickfmt='%.2g' for the old colorbar or format='%.2g' for the new one. 
The new one should automatically choose a suitable format, but I see 
there is a problem with that. I have to look into it.
Eric
From: Marcel O. <m.o...@iu...> - 2006年05月17日 23:21:56
Hi, I have a plot which is divided into 3x3 subplots, each of
which is generated by imshow. I now want to do the following
and have difficulties finding the appropriate documentation:
1. Display a single title for the entire plot. title() will either
 have no effect or attach the title to a separate subplot.
2. Have the same color scale on each subplot. Is it possible to
 use automatic scaling?
3. Attach a single colorbar to the entire plot, rather than
 9 identical scales to each subplot.
4. Have the labeling of the colorbar use the scientific
 number format. I sometimes have rather small values,
 and colorbar() will display 0.0 throughout the scale.
I'd be grateful for any hints,
Marcel
From: Ryan K. <rya...@gm...> - 2006年05月17日 21:03:30
I am trying to create plots that look good in color or grayscale (I
had asked about this before and was trying to write code with a switch
- now I just want decent looking plots without having to switch - and
I never really finished the with switching stuff either).
I use the pylab interface and rely a lot on the default behavior for
incrementing my colors when I overlay plots - i.e. I call plot
different times with different data and it automatically makes the
first one blue and the second green, ...
How do I change the default color order and how do I set up a similar
default linetype order, so that the first call to plot generates a
solid line and the second a dashed one (for example).
Thanks,
Ryan
From: Eric F. <ef...@ha...> - 2006年05月17日 16:32:11
Albert Swart wrote:
> 
> Matlab 's contour function returns the contour data as x- and y- 
> coordinates in a contour matrix C:
> 
> [C,H] = CONTOUR(...)
You are using an old version of Matlab...
> 
> pylab.contour(...) returns a ContourSet object that only seems to 
> contain contour heights. How do I get the actual contour data? I need 
> the (x,y) coordinates as given by matlab. In fact even the binary 
> contour image that is displayed by contour() will be usefull.
> 
> albert
The ContourSet object includes the attribute "collections", a list of 
LineCollections or PolyCollections (for contour and contourf, 
respectively), with one collection per line or color band. For each 
collection in the list, you can access the vertices using the 
get_verts() method.
Eric
From: Clovis G. <cl...@pe...> - 2006年05月17日 14:15:14
>
>
>>>>"clovis" == clovis <cl...@pe...> writes:
>>>> 
>>>>
>
> clovis> All, I followed up the 'memory leak' discussion in the
> clovis> sourceforge list and I know the Matplotlib-FAQ entry about
> clovis> this subject. I've also seen John Hunter's post about the
> clovis> need of matching figure/close pairs. Anyway, I still feel
> clovis> that there are problems in this subject, which can be
> clovis> exposed by the following script (for Windows, but can
> clovis> easily be adapted to Unix).
>
> clovis> As can be seen by the results (also given below), there is
> clovis> a steady increase in memory usage which is not recovered!
>
>If I recall correctly, there is a known leak in tkagg when you create
>multiple canvases, and this is in Tk and not matplotlib proper. Todd
>may have something to add here. 
>
>JDH
>
>
> 
>
Yesterday you mentioned that that 'memory leak' would probably be caused 
by Tkagg
and not by matplotlib. You also mentioned that it would be good to hear 
Todd Miller
about this subject (I agree).
Following your idea I tested the memory usage under different backends.
The results are given below:
##############
#TKAgg results
##############
Date/time of test = Wed May 17 10:08:39 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = TkAgg
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 15740 21564 5824
Memory usage before/after figure[ 1] = 21564 25944 4380
Memory usage before/after figure[ 2] = 25944 30316 4372
Memory usage before/after figure[ 3] = 30316 34668 4352
Memory usage before/after figure[ 4] = 34668 39020 4352
Memory usage before/after figure[ 5] = 39020 43376 4356
Memory usage before/after figure[ 6] = 43376 47740 4364
Memory usage before/after figure[ 7] = 47740 52096 4356
Memory usage before/after figure[ 8] = 52096 56472 4376
Memory usage before/after figure[ 9] = 56472 60836 4364
############
#Agg results
############
Date/time of test = Wed May 17 09:24:26 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = Agg
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 14160 17008 2848
Memory usage before/after figure[ 1] = 17008 17504 496
Memory usage before/after figure[ 2] = 17504 17604 100
Memory usage before/after figure[ 3] = 17604 17604 0
Memory usage before/after figure[ 4] = 17604 17588 -16
Memory usage before/after figure[ 5] = 17588 17608 20
Memory usage before/after figure[ 6] = 17608 17600 -8
Memory usage before/after figure[ 7] = 17600 17596 -4
Memory usage before/after figure[ 8] = 17596 17584 -12
Memory usage before/after figure[ 9] = 17584 17604 20
##############
#Cairo results
##############
Date/time of test = Wed May 17 10:29:09 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = Cairo
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 14024 15436 1412
Memory usage before/after figure[ 1] = 15436 15944 508
Memory usage before/after figure[ 2] = 15944 16252 308
Memory usage before/after figure[ 3] = 16252 16460 208
Memory usage before/after figure[ 4] = 16460 16468 8
Memory usage before/after figure[ 5] = 16468 18448 1980
Memory usage before/after figure[ 6] = 18448 18464 16
Memory usage before/after figure[ 7] = 18464 16744 -1720
Memory usage before/after figure[ 8] = 16744 18144 1400
Memory usage before/after figure[ 9] = 18144 18488 344
#################
#GTKCairo results
#################
Date/time of test = Wed May 17 10:28:45 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = GTKCairo
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 20888 26384 5496
Memory usage before/after figure[ 1] = 26384 26972 588
Memory usage before/after figure[ 2] = 26972 28224 1252
Memory usage before/after figure[ 3] = 28224 27848 -376
Memory usage before/after figure[ 4] = 27848 27440 -408
Memory usage before/after figure[ 5] = 27440 29444 2004
Memory usage before/after figure[ 6] = 29444 29668 224
Memory usage before/after figure[ 7] = 29668 28840 -828
Memory usage before/after figure[ 8] = 28840 28804 -36
Memory usage before/after figure[ 9] = 28804 29884 1080
############
#GTK results
############
Date/time of test = Wed May 17 09:20:02 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = GTK
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 22128 28044 5916
Memory usage before/after figure[ 1] = 28048 28624 576
Memory usage before/after figure[ 2] = 28624 28804 180
Memory usage before/after figure[ 3] = 28804 28872 68
Memory usage before/after figure[ 4] = 28872 28948 76
Memory usage before/after figure[ 5] = 28948 29020 72
Memory usage before/after figure[ 6] = 29020 29080 60
Memory usage before/after figure[ 7] = 29080 29144 64
Memory usage before/after figure[ 8] = 29144 29240 96
Memory usage before/after figure[ 9] = 29240 29292 52
###############
#GTKAgg results
###############
Date/time of test = Wed May 17 09:20:24 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = GTKAgg
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 23880 31124 7244
Memory usage before/after figure[ 1] = 31124 31708 584
Memory usage before/after figure[ 2] = 31708 31904 196
Memory usage before/after figure[ 3] = 31904 32308 404
Memory usage before/after figure[ 4] = 32308 32388 80
Memory usage before/after figure[ 5] = 32388 32144 -244
Memory usage before/after figure[ 6] = 32144 32560 416
Memory usage before/after figure[ 7] = 32560 32276 -284
Memory usage before/after figure[ 8] = 32276 32380 104
Memory usage before/after figure[ 9] = 32380 32444 64
############
#EMF results
############
Date/time of test = Wed May 17 09:18:19 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = EMF
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=True SAVEFIG=True
Memory usage before/after figure[ 0] = 12352 13268 916
Memory usage before/after figure[ 1] = 13268 13732 464
Memory usage before/after figure[ 2] = 13732 13896 164
Memory usage before/after figure[ 3] = 13896 13900 4
Memory usage before/after figure[ 4] = 13900 13804 -96
Memory usage before/after figure[ 5] = 13804 13904 100
Memory usage before/after figure[ 6] = 13904 13904 0
Memory usage before/after figure[ 7] = 13904 13912 8
Memory usage before/after figure[ 8] = 13912 13836 -76
Memory usage before/after figure[ 9] = 13836 13920 84
###########
#PS results
###########
Date/time of test = Wed May 17 09:21:15 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = PS
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 12912 14032 1120
Memory usage before/after figure[ 1] = 14032 14508 476
Memory usage before/after figure[ 2] = 14508 16344 1836
Memory usage before/after figure[ 3] = 16344 16548 204
Memory usage before/after figure[ 4] = 16548 17032 484
Memory usage before/after figure[ 5] = 17032 16996 -36
Memory usage before/after figure[ 6] = 16996 16648 -348
Memory usage before/after figure[ 7] = 16648 14876 -1772
Memory usage before/after figure[ 8] = 14876 16928 2052
Memory usage before/after figure[ 9] = 16928 16804 -124
############
#SVG results
############
Date/time of test = Wed May 17 09:21:34 2006
OS version = 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 
bit (Intel)]
OS platform = win32
Matplotlib version = 0.87
Matplotlib revision = $Revision: 1.122 $
Matplotlib backend = SVG
Column #0 = figure index
Column #1 = memory usage before figure
Column #2 = memory usage after figure
Column #3 = (after-before) memory
Configuration SHOWFIG=False SAVEFIG=True
Memory usage before/after figure[ 0] = 12844 13648 804
Memory usage before/after figure[ 1] = 13648 14128 480
Memory usage before/after figure[ 2] = 14128 14224 96
Memory usage before/after figure[ 3] = 14224 14224 0
Memory usage before/after figure[ 4] = 14224 14224 0
Memory usage before/after figure[ 5] = 14224 14228 4
Memory usage before/after figure[ 6] = 14228 14228 0
Memory usage before/after figure[ 7] = 14228 14228 0
Memory usage before/after figure[ 8] = 14228 14228 0
Memory usage before/after figure[ 9] = 14228 14228 0
As can be seen by the previously show results, it seems that the TKAgg 
still has some problems.
I'm not worried the the 'DC level' of the backends or with the results 
concerning figure[0].
The problem I'm pointing is the continuous increase in memory usage in 
the TKAgg backend.
The script used for these tests is:
import pylab
import os
import time
N = 10 # number of loops to execute
SAVEFIG = True # SAVEFIG execution flag
SHOWFIG = False # SHOWFIG execution flag
report_filename = 'memory_report_%s.txt' % pylab.matplotlib.get_backend()
fid = file(report_filename,'wt')
fid.write('Date/time of test = %s\n' % time.asctime())
fid.write('OS version = %s\n' % os.sys.version)
fid.write('OS platform = %s\n' % os.sys.platform)
fid.write('Matplotlib version = %s\n' % pylab.matplotlib.__version__)
fid.write('Matplotlib revision = %s\n' % pylab.matplotlib.__revision__)
fid.write('Matplotlib backend = %s\n' % pylab.matplotlib.get_backend())
fid.write('Column #0 = figure index\n')
fid.write('Column #1 = memory usage before figure\n')
fid.write('Column #2 = memory usage after figure\n')
fid.write('Column #3 = (after-before) memory\n')
 
pylab.ion()
a=pylab.arange(0,10)
def report_memory():
 ### Attention: the path to the pslist utility should be adjusted 
according to installation!
 if os.sys.platform == 'win32':
 ps_exe_filename = os.path.join(os.getcwd(),'pslist.exe') 
#Build ps filename
 a = os.popen('%s -m python' % ps_exe_filename).readlines() 
#Build and execute command
 b = a[8]
 c = b.split()
 return int(c[3])
 else:
 print 'Sorry, you have to adapt the command for your OS!'
 return 0
def figureloop(N):
 for i in range(0,N):
 memory_usage_before = report_memory()
 fid.write('Memory usage before/after figure[%2d] = %8d' % (i, 
memory_usage_before))
 pylab.figure(i)
 pylab.plot(a,2*a)
 figurename = 'fig%02d' % i
 if SAVEFIG:
 pylab.savefig(figurename)
 pylab.savefig(figurename+'.eps')
 if SHOWFIG:
 pylab.show()
 pylab.close(i)
 time.sleep(1.0) # wait 1.0 second before 
inspecting memory usage
 if os.path.isfile(figurename): # remove figure ...
 #os.remove(figurename)
 pass
 memory_usage_after = report_memory()
 delta_memory = memory_usage_after - memory_usage_before
 fid.write(' %8d %8d\n' % (memory_usage_after, delta_memory))
 print '%2d %6d %6d %6d' % (i, memory_usage_before, 
memory_usage_after, delta_memory)
 
print 'Column #0 = figure index'
print 'Column #1 = memory usage before figure'
print 'Column #2 = memory usage after figure'
print 'Column #3 = (after-before) memory'
print 'There is a sleep time of 1s between each figure!'
print 'Close Figure[0] to continue execution!'
print('\nConfiguration SHOWFIG=%s SAVEFIG=%s' % (SHOWFIG, SAVEFIG))
fid.write('\nConfiguration SHOWFIG=%s SAVEFIG=%s\n' % (SHOWFIG, SAVEFIG))
figureloop(N)
This script should be executed with the backend parameters, such as:
 python memory_test.py -dTKAgg
 python memory_test.py -dAgg
 etc
for all the desired backends.
Thanks for your support and congratulations for your great work 
(matplotlib).
clovis

Showing results of 165

<< < 1 2 3 4 5 6 7 > >> (Page 4 of 7)
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 によって変換されたページ (->オリジナル) /