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






Showing results of 362

<< < 1 .. 3 4 5 6 7 .. 15 > >> (Page 5 of 15)
From: Stef M. <ste...@gm...> - 2008年11月21日 00:27:41
Mauro Cavalcanti wrote:
> Dear Chris,
>
> Thank your very much for your prompt reply.
>
> 2008年11月20日 Christopher Barker <Chr...@no...>:
>
> 
>> well, I love sizers -- but they do take a while to wrap your brain around.
>> 
>
> I love Python *and* wxPython/wxWidgets -- but having worked several
> years with RAD tools like Visual Basic and (much better) Borland
> Delphi, I find all available GUI builders for Python very limited (and
> sizers are among these perceived limitations).
>
> 
I agree (coming from Delphi), they either don't work or are too limited.
For wxPython I developed a very simple method, which even has the F12 
function ;-)
 http://mientki.ruhosting.nl/data_www/pylab_works/pw_gui_support.htm
code can be downloaded here
 http://code.google.com/p/pylab-works/downloads/list
btw I would love to see your Basemap,
(but as I'm in the iddle of releasing a large project based on an old 
version of MatPlatLib,
so I don't dare to update),
are there any screenshots ?
thanks,
Stef Mientki
From: Mauro C. <mau...@gm...> - 2008年11月20日 23:08:25
Dear Chris,
Thank your very much for your prompt reply.
2008年11月20日 Christopher Barker <Chr...@no...>:
> well, I love sizers -- but they do take a while to wrap your brain around.
I love Python *and* wxPython/wxWidgets -- but having worked several
years with RAD tools like Visual Basic and (much better) Borland
Delphi, I find all available GUI builders for Python very limited (and
sizers are among these perceived limitations).
> Your difficulty probably stems from using a combination of wxGlade and
> handwritten code. Also, I don't know if wxGlade forces you to do it this
As a matter of fact, wxGlade forces one to do this. I usually do not
like (or use) code generated by wxGlade, but for rapid prototyping I
find it to be better than, for example, Boa Constructor (which is as
huge and slow is the boa snakes themselves).
> you've given "self" as the parent of your FigureCanvas, when it needs to be
> parented by the Panel it goes on, which I think is self.PlotPanel, so the
> above line should be:
Sure, it worked, but I still have problems with properly sizing the
figure. This I could amend by declaring:
self.figure = Figure()
instead of self.figure = Figure(figsize=(10,5))
and:
self.ax = self.figure.add_subplot(111)
instead of self.ax = self.figure.add_axes([0,0,1,1])
However the figure is still not properly sized when the window is
maximized (but this is obviously another problem with my handling of
wxPython classes).
I hope to have this example up and running as it may be a useful
addition to the collection of examples in the Basemap module, saving a
lot of time for others!
With best regards,
-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
From: Eric F. <ef...@ha...> - 2008年11月20日 23:04:38
Matthias Michler wrote:
> Hello list,
> 
> I observe a small bug in slider_demo.py, which lives in the svn 
> folder /examples/widgets and can be accessed via
> http://matplotlib.sourceforge.net/_static/plot_directive/mpl_examples/widgets/slider_demo.py .
> 
> The hovercolor for grey needs to be a string instead of a float. I attached a 
> small patch for simplicity.
Thank you, I applied it.
Eric
From: Eric F. <ef...@ha...> - 2008年11月20日 22:53:23
Michael Outhouse wrote:
> I was wondering if it is possible to change the colorbar tick labeling in 
> matplotlib from numeric to text. Essentially, I want the colorbar to be a 
> qualitative indicator; in the jet scheme, I'd like blue to be labeled 
> as 'unstable', green as 'neutral', and red as 'stable'. I can change it so I 
> just show the underlying values - colorbar(ticks = (-1, 0, 1)), but I cannot 
> change the the tick labels to text. Is there any way to accomplish this? 
> Thanks in advance for any help.
Your message came more than a month ago, but it looks like no one 
answered, so here is an answer:
with ipython -pylab:
imshow(2*rand(10,10) - 1, vmin=-1, vmax=1)
cbar = colorbar(ticks=[-1,0,1])
cbar.ax.set_yticklabels(['unstable', 'neutral', 'stable'])
draw()
From: Christopher B. <Chr...@no...> - 2008年11月20日 22:44:06
Mauro Cavalcanti wrote:
> Well, at least it should! It turns out that the map is correctly
> displayed, but it then fills almost the whole parent window,
> overlapping the left panel where the notebook with the listbox and the
> text control should appear! This illustrates one of the worst (in my
> opinion) things about wxPython, that is the handling of "sizers" to
> correctly place the widgets on an application window.
well, I love sizers -- but they do take a while to wrap your brain around.
Your difficulty probably stems from using a combination of wxGlade and 
handwritten code. Also, I don't know if wxGlade forces you to do it this 
way, but you have a whole bunch of stuff all nested in the Frame, when 
it would be better designed if each component was it's own class.
anyway, I think your problem is:
# ----- UNCOMMENT THE LINES BELOW TO DRAW THE MAP
		#self.figure = Figure(figsize=(10,5))
		#self.canvas = FigureCanvas(self, -1, self.figure)
you've given "self" as the parent of your FigureCanvas, when it needs to 
be parented by the Panel it goes on, which I think is self.PlotPanel, so 
the above line should be:
self.canvas = FigureCanvas(self.PlotPanel, -1, self.figure)
One thing wx does do "wrong" is let you put a control on one parent, 
then Add it to a sizer attached to a different parent -- it should 
probably raise an error when you do that.
-Chris
 --
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
On Thu, Nov 20, 2008 at 8:14 PM, John Hunter <jd...@gm...> wrote:
>
> One more thought -- if you are in pylab mode (so "interactive" is
> turned on) if you are making your draw calls through the api, as you
> are in this example, you will need to call draw after the plot
> commands, eg
>
> ax.plot(something)
> f.canvas.draw()
Right, that's it - with wx I need to use canvas.draw... I was aware of
the need to use something, but with Tk was previously using
figure.show (possibly incorrectly having read the documentation)-
which doesn't have any effect in the wx case.
Thanks very much to everyone for the prompt responses today!
Cheer
Robin
From: Mauro C. <mau...@gm...> - 2008年11月20日 20:50:25
Dear ALL,
Just a simple (?) question on Matplotlib GUI backends toolbars. The
Matplotlib examples include a nice sample of programmatically adding a
button to a backend toolbar, but I could not find out how to *remove*
one or more of the buttons from the default toolbar. Has it be
sub-classed? BTW, is there any way to access (from a program) the
methods bound to each toolbar button?
Thanks again for your attention (and patience, of course!)
With best regards,
-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
From: Eric B. <eri...@gm...> - 2008年11月20日 20:40:04
I just saw a similar error when trying to plot some text; in my case,
basemap wasn't involved.
The full error dump:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/text.py
in draw(self, renderer)
 486
--> 487 for line, wh, x, y in info:
 488 x = x + posx
 489 y = y + posy
TypeError: CXX : Error creating object of type N2Py3IntE
My x data were times in seconds calculated relative to a reference
date, and reducing the gap cleared up my problem.
This thread:
http://markmail.org/message/zqfgrshmq3366mtz?q=Error+N2Py3IntE
suggests that the error is due to an overflow in the underlying numerics.
And ... this is where I reach the end of my expertise.
-Eric
On Thu, Nov 13, 2008 at 11:38 PM, John [H2O] <was...@gm...> wrote:
>
> Hello, using matplotlib 0.98 with mpl_toolkit Basemap:
>
> I'm trying to create a plot with a series of ellipses over a map. I've
> followed the tutorial, and can create the same figure as shown here:
> http://matplotlib.sourceforge.net/users/screenshots.html#ellipses
>
> I can also create a series of ellipses over a map.
>
> Now I am trying to label each circle using the following snippet:
> for item in ells:
> #ells is now a tuple in the form: (Ellipse, (x,y)) and (x,y) is the same
> as for the Ellipse
> e = item[0]
> xy = item[1]
> ax.add_artist(e)
> e.set_clip_box(ax.bbox)
> e.set_alpha(.7)
> pyplot.text(xy[0],xy[1],e.get_label())
>
> however, for some reason it fails. Can someone provide some ideas on what I
> am doing wrong? Also, is there more direct way to set the plots so that the
> labels are drawn?
>
> What is strange, is that it seems to work (at least debugging print
> statements after the loop are printed)... and I can move the text function
> out of the loop to label the 'last' ellipse...
>
> As it is it fails when savefig() or show() are called. The error is:
> TypeError: CXX : Error creating object of type N2Py3IntE
>
> THoughts?
>
> Thanks,
> john
>
> --
> View this message in context: http://www.nabble.com/plotting-labels-for-each-%27artist%27-in-a-basemap-tp20494609p20494609.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Mauro C. <mau...@gm...> - 2008年11月20日 20:31:33
Attachments: Gaia.py cities.csv
Dear ALL,
Enclosed is an sample application I put together (partially using
wxGlade) that is a first attempt at providing a working example of a
GUI frontend with wxPython and Matplotlib/Basemap.
The application consists of two panels, separated by a splitter. The
left panel has a notebook with two pages, which have, respectively, a
listbox and a read-only multine text control. The right panel has a
figure object created at runtime, to which a basemap object is
attached.
The application reads comma-delimited data files of geographic
coordinates (in decimal format) selected by the user, appending them
to the listbox. When a file is selected on the list, the points are
plotted on the basemap displayed in the panel to the right.
Well, at least it should! It turns out that the map is correctly
displayed, but it then fills almost the whole parent window,
overlapping the left panel where the notebook with the listbox and the
text control should appear! This illustrates one of the worst (in my
opinion) things about wxPython, that is the handling of "sizers" to
correctly place the widgets on an application window.
I have commented the parts of the code where the map is created, so
that one can see clearly what happens with and without the map plot.
Just uncomment these parts to see the map displayed (with a toolbar
properly placed, at least under Linux).
If someone can help me with this, this sample application could
provide a useful skeleton to build programs which integrate
Matplotlib/Basemap with wxPython (incidentally, this sample
application bears a very slight resemblance to Google Earth... :)). I
am, of course, donating it to the community.
Thanks in advance!
With best regards,
-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
From: John H. <jd...@gm...> - 2008年11月20日 20:14:26
On Thu, Nov 20, 2008 at 1:29 PM, Robin <ro...@gm...> wrote:
> On Thu, Nov 20, 2008 at 5:22 PM, Christopher Barker
>> try wxPython -- it's easy to install and works well.
>
> Thanks - it does seem nicer (doesn't have the mouse over resizing)...
>
> However I have one problem where a figure I create in a function
> doesn't show up:
> # this is how I create a figure in a function
> In [20]: def test_func():
> ....: f = figure()
> ....: ax = f.add_subplot(111)
> ....: ax.plot([1,2,3,4],[1,2,3,4])
> ....: f.show()
> ....: return f
> ....:
One more thought -- if you are in pylab mode (so "interactive" is
turned on) if you are making your draw calls through the api, as you
are in this example, you will need to call draw after the plot
commands, eg
 ax.plot(something)
 f.canvas.draw()
This is explained in some detail in the shell page I pointed you to in
my last post.
JDH
From: John H. <jd...@gm...> - 2008年11月20日 20:11:50
On Thu, Nov 20, 2008 at 1:29 PM, Robin <ro...@gm...> wrote:
> On Thu, Nov 20, 2008 at 5:22 PM, Christopher Barker
>> try wxPython -- it's easy to install and works well.
>
> Thanks - it does seem nicer (doesn't have the mouse over resizing)...
>
> However I have one problem where a figure I create in a function
> doesn't show up:
> # this is how I create a figure in a function
Are you running ipython in pylab mode? See
 http://matplotlib.sourceforge.net/users/shell.html
and
 http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show
From: Benoît Z. <bz...@mr...> - 2008年11月20日 19:33:17
Hi,
I have noticed a memory leak when using pylab.pcolor. Here is the code,
fa() and fb() do the same thing. The difference is the size of the array
which is passed to pcolor. With a large array pcolor leaks but not with a
small one.
Cheers,
Ben
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pylab
def fa():
 """ This function leaks.
 """
 a = np.arange(1024**2)
 a = a.reshape(1024,1024)
 for i in range(1):
 pylab.pcolor(a)
 pylab.close()
def fb():
 """This function does not leak.
 """
 b = np.arange(1024)
 b = b.reshape(32,32)
 for i in range(1024):
 pylab.pcolor(b)
 pylab.close()
On Thu, Nov 20, 2008 at 5:22 PM, Christopher Barker
> try wxPython -- it's easy to install and works well.
Thanks - it does seem nicer (doesn't have the mouse over resizing)...
However I have one problem where a figure I create in a function
doesn't show up:
# this is how I create a figure in a function
In [20]: def test_func():
 ....: f = figure()
 ....: ax = f.add_subplot(111)
 ....: ax.plot([1,2,3,4],[1,2,3,4])
 ....: f.show()
 ....: return f
 ....:
In [21]: test_func()
Out[21]: <matplotlib.figure.Figure object at 0x2168c8d0>
# shows a blank (grey) canvas with no axes
In [23]: _21.show()
# ^^ does nothing
In [25]: gcf().show()
# ^^ does nothing
In [26]: f2 = figure(1)
# ^^ now it appears?
So what am I doing wrong? How can I programmatically display a figure
(ie without knowing the number in advance to do figure(n)?)
Cheers
Robin
From: Jeff W. <js...@fa...> - 2008年11月20日 18:19:41
Hrafnkell Pálsson wrote:
> Jeff Whitaker wrote:
> 
>> Hrafnkell:
>>
>> Had some time this morning, so I used John's method to create a working
>> Basemap example:
>>
>> import matplotlib
>> matplotlib.use('Agg')
>> from mpl_toolkits.basemap import Basemap
>> import matplotlib.pyplot as plt
>>
>> # this example shows how to save a map background and
>> # reuse it in another figure.
>>
>> # make sure we have all the same properties on all figs
>> figprops = dict(figsize=(8,6), dpi=100, facecolor='white')
>>
>> # generate the first figure.
>> fig1 = plt.figure(1,**figprops)
>> ax1 = fig1.add_subplot(111)
>> # create basemap instance, plot coastlines.
>> map = Basemap(projection='moll',lon_0=0)
>> map.drawcoastlines()
>> map.drawmapboundary(fill_color='aqua')
>> map.fillcontinents(color='coral',lake_color='aqua')
>> fig1.canvas.draw()
>> background = fig1.canvas.copy_from_bbox(fig1.bbox)
>> fig1.savefig('figure1.png', dpi=100)
>>
>>
>> # generate the second figure, re-using the background
>> # from figure 1.
>> fig2 = plt.figure(2,frameon=False,**figprops)
>> ax2 = fig2.add_subplot(111, frameon=False, xticks=[], yticks=[])
>> # restore previous background.
>> fig2.canvas.restore_region(background)
>> # draw parallels and meridians on existing background.
>> map.drawparallels(range(-90,90,30))
>> map.drawmeridians(range(-180,180,60))
>> fig2.savefig('figure2.png', dpi=100)
>>
>>
>> I've added this to the basemap examples directory as save_background.py
>>
>> HTH,
>>
>> -Jeff
>>
>> 
>
> There's still one snag.
> Using your example I could restore the background.
> But it turns out everything is plotted over the background; so if my
> background consist only of the coastline and then I do a filled contour plot
> after restoring it the coastline disappears under the filled contours (by
> using the alpha keyword to contourf I could see the coastline beneath).
>
> Had I plotted the coastline into the figure instead of restoring it this
> would not have happened.
>
> Is there any way of avoiding this?
>
> Hrafnkell
>
>
>
> 
Hrafnkell:
I see your point, but I don't see any obvious solution. Perhaps someone with more knowledge of matplotlib internals (John?) can answer.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Hrafnkell P. <hr...@hi...> - 2008年11月20日 17:50:41
Jeff Whitaker wrote:
> 
> Hrafnkell:
> 
> Had some time this morning, so I used John's method to create a working
> Basemap example:
> 
> import matplotlib
> matplotlib.use('Agg')
> from mpl_toolkits.basemap import Basemap
> import matplotlib.pyplot as plt
> 
> # this example shows how to save a map background and
> # reuse it in another figure.
> 
> # make sure we have all the same properties on all figs
> figprops = dict(figsize=(8,6), dpi=100, facecolor='white')
> 
> # generate the first figure.
> fig1 = plt.figure(1,**figprops)
> ax1 = fig1.add_subplot(111)
> # create basemap instance, plot coastlines.
> map = Basemap(projection='moll',lon_0=0)
> map.drawcoastlines()
> map.drawmapboundary(fill_color='aqua')
> map.fillcontinents(color='coral',lake_color='aqua')
> fig1.canvas.draw()
> background = fig1.canvas.copy_from_bbox(fig1.bbox)
> fig1.savefig('figure1.png', dpi=100)
> 
> 
> # generate the second figure, re-using the background
> # from figure 1.
> fig2 = plt.figure(2,frameon=False,**figprops)
> ax2 = fig2.add_subplot(111, frameon=False, xticks=[], yticks=[])
> # restore previous background.
> fig2.canvas.restore_region(background)
> # draw parallels and meridians on existing background.
> map.drawparallels(range(-90,90,30))
> map.drawmeridians(range(-180,180,60))
> fig2.savefig('figure2.png', dpi=100)
> 
> 
> I've added this to the basemap examples directory as save_background.py
> 
> HTH,
> 
> -Jeff
> 
There's still one snag.
Using your example I could restore the background.
But it turns out everything is plotted over the background; so if my
background consist only of the coastline and then I do a filled contour plot
after restoring it the coastline disappears under the filled contours (by
using the alpha keyword to contourf I could see the coastline beneath).
Had I plotted the coastline into the figure instead of restoring it this
would not have happened.
Is there any way of avoiding this?
Hrafnkell
-- 
View this message in context: http://www.nabble.com/Save-a-plot-background-tp20519596p20606641.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2008年11月20日 17:50:02
Cyrille Rosset wrote:
> Hello,
> 
> It seems to me there is a bug in matplotlib 0.98.3 (or at least a 
> change from previous version).
> 
> >>> matplotlib.cbook.is_scalar('foo')
> False
> 
> I would expect this to be True (otherwise, 
> matplotlib.cbook.flatten(['foo']) enters an infinite recursive loop).
This has been fixed in svn:
In [1]:import matplotlib.cbook as cb
In [5]:list(cb.flatten(['foo']))
Out[5]:['foo']
See Revision 6128:
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/cbook.py?view=log
> 
> It used to be (0.98.0):
> return is_string_like(obj) or not iterable(obj)
> and now (0.98.3):
> return not is_string_like(obj) and not iterable(obj)
> 
> If it is by purpose, could someone explain it to me ? I'll then have 
> to change my code accordingly.
> 
> Thanks a lot in advance,
> Cyrille Rosset.
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Mauro C. <mau...@gm...> - 2008年11月20日 17:36:24
Dear Robin,
I do agree (although the Python gurus here highly recommend Qt
instead). wxPython is well documented and has *plenty* of exemples
(much of them truly useful).
I have been working hard to developing a scientific desktop
application which uses wxPython for its GUI frontend and
Matplotlib/Basemap for plotting maps and bar charts. Have learned a
few tricks (and the help of John Hunter and Jeff Whittaker is much
appreciated), which I will make available to all as soon as possible.
Regards,
2008年11月20日 Christopher Barker <Chr...@no...>:
> Robin wrote:
>> Now you point it out it is clear that that is what is causing it. I'm
>> using python.org python on a Mac and it's not clear to me how best to
>> install Qt - so at the moment Tk is the only working backend I have.
>
> try wxPython -- it's easy to install and works well.
>
> -Chris
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R (206) 526-6959 voice
> 7600 Sand Point Way NE (206) 526-6329 fax
> Seattle, WA 98115 (206) 526-6317 main reception
>
> Chr...@no...
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
But given the vagueness of what I asked, you're right, os.makedirs was
a good suggestion too. Thanks. I think I need to sit down and spend
some quality time with the os module over Thanksgiving holiday...
Josh
On Thu, Nov 20, 2008 at 9:30 AM, Joshua Lippai <dis...@gm...> wrote:
> cbook.mkdirs includes a few if-then calls that only make the directory
> if it doesn't already exist (in fact it actually calls os.makedirs in
> the function), whereas os.makedirs raises an OSError if the folder I
> specified already exists. For my purposes, the cbook implementation is
> more convenient.
>
> Josh
>
> On Thu, Nov 20, 2008 at 9:22 AM, Christopher Barker
> <Chr...@no...> wrote:
>> Joshua Lippai wrote:
>>> Now that just leaves creating the directory. I like
>>> the cbook.mkdirs implementation a lot better than the non-recursive
>>> version in os... thanks for the tip!
>>
>> why not os.makedirs() ?
>>
>> -Chris
>>
>> --
>> Christopher Barker, Ph.D.
>> Oceanographer
>>
>> Emergency Response Division
>> NOAA/NOS/OR&R (206) 526-6959 voice
>> 7600 Sand Point Way NE (206) 526-6329 fax
>> Seattle, WA 98115 (206) 526-6317 main reception
>>
>> Chr...@no...
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
cbook.mkdirs includes a few if-then calls that only make the directory
if it doesn't already exist (in fact it actually calls os.makedirs in
the function), whereas os.makedirs raises an OSError if the folder I
specified already exists. For my purposes, the cbook implementation is
more convenient.
Josh
On Thu, Nov 20, 2008 at 9:22 AM, Christopher Barker
<Chr...@no...> wrote:
> Joshua Lippai wrote:
>> Now that just leaves creating the directory. I like
>> the cbook.mkdirs implementation a lot better than the non-recursive
>> version in os... thanks for the tip!
>
> why not os.makedirs() ?
>
> -Chris
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R (206) 526-6959 voice
> 7600 Sand Point Way NE (206) 526-6329 fax
> Seattle, WA 98115 (206) 526-6317 main reception
>
> Chr...@no...
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
On Thu, Nov 20, 2008 at 11:22 AM, Christopher Barker
<Chr...@no...> wrote:
> Joshua Lippai wrote:
>> Now that just leaves creating the directory. I like
>> the cbook.mkdirs implementation a lot better than the non-recursive
>> version in os... thanks for the tip!
>
> why not os.makedirs() ?
Wow, that one went right by me -- somehow missed its existence.
Thanks for the pointer...
JDH
From: Christopher B. <Chr...@no...> - 2008年11月20日 17:22:22
Robin wrote:
> Now you point it out it is clear that that is what is causing it. I'm
> using python.org python on a Mac and it's not clear to me how best to
> install Qt - so at the moment Tk is the only working backend I have.
try wxPython -- it's easy to install and works well.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
Joshua Lippai wrote:
> Now that just leaves creating the directory. I like
> the cbook.mkdirs implementation a lot better than the non-recursive
> version in os... thanks for the tip!
why not os.makedirs() ?
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
Ah, silly me. I forgot to notice I was using a path variable in the
string I was giving to mlab.save. Part A works just fine when I
account for that. Now that just leaves creating the directory. I like
the cbook.mkdirs implementation a lot better than the non-recursive
version in os... thanks for the tip!
Josh
On Thu, Nov 20, 2008 at 8:48 AM, John Hunter <jd...@gm...> wrote:
> On Thu, Nov 20, 2008 at 10:24 AM, Joshua Lippai <dis...@gm...> wrote:
>> Hey,
>>
>> I'm working on a project for which I would like to dump data into a
>> file in a specified directory (that doesn't necessarily exist yet). I
>> know matplotlib.mlab.save(fname, X) will only work if I want to save
>> data from an array/list to a file in the current working directory. Is
>> there an easy way using matplotlib to:
>>
>> A) Save a file to a specified directory rather than the current
>> working directory
>
> Just specify the full path to the output dir:
>
> save('/path/to/my/data.dat')
>
> or use the os modules built-in functions for cross-platform path handling:
>
> save(os.path.join(outdir, filename))
>
>> B) Create a directory I tell it to save to if it doesn;t already exist
>
> You can use os.mkdir. mpl svn has a function cbook.mkdirs to
> recursively make a directory path.
>
> JDH
>
On Thu, Nov 20, 2008 at 10:24 AM, Joshua Lippai <dis...@gm...> wrote:
> Hey,
>
> I'm working on a project for which I would like to dump data into a
> file in a specified directory (that doesn't necessarily exist yet). I
> know matplotlib.mlab.save(fname, X) will only work if I want to save
> data from an array/list to a file in the current working directory. Is
> there an easy way using matplotlib to:
>
> A) Save a file to a specified directory rather than the current
> working directory
Just specify the full path to the output dir:
 save('/path/to/my/data.dat')
or use the os modules built-in functions for cross-platform path handling:
 save(os.path.join(outdir, filename))
> B) Create a directory I tell it to save to if it doesn;t already exist
You can use os.mkdir. mpl svn has a function cbook.mkdirs to
recursively make a directory path.
JDH
Hey,
I'm working on a project for which I would like to dump data into a
file in a specified directory (that doesn't necessarily exist yet). I
know matplotlib.mlab.save(fname, X) will only work if I want to save
data from an array/list to a file in the current working directory. Is
there an easy way using matplotlib to:
A) Save a file to a specified directory rather than the current
working directory
B) Create a directory I tell it to save to if it doesn;t already exist
Thanks in advance.
Josh
1 message has been excluded from this view by a project administrator.

Showing results of 362

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