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

Showing results of 498

<< < 1 .. 6 7 8 9 10 .. 20 > >> (Page 8 of 20)
From: mzs <ms...@Th...> - 2009年01月21日 12:39:07
Yes, I did have an typo in when reporting the problem, it should be pyplot
not plot. However, the problem is with pyplot anyway. The version of
matplotlib is 0.90.1 as shown here:
 >>> import matplotlib.pyplot as plt
 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 ImportError: No module named pyplot
 >>> import matplotlib
 >>> print matplotlib.__version__
 0.90.1
 >>> 
If this version is to young then how can I get Ubuntu to load a later
version?
Thank you for your response. Again, I appreciate any help anyone could
provide.
Ryan May-3 wrote:
> 
> mzs wrote:
>> Hi,
>> 
>> I am using Ubuntu Gutsy 7.10 and want to use matplotlib.pyplot but when I
>> execute:
>> 
>>> import matplotlib.pyplot as plt
>> 
>> I get:
>> 
>>>>> import matplotlib.plot as plt
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: No module named plot
>> 
>> I installed matplotlib using synaptic.
>> 
>> I found another reference to this problem on Google but no solution.
>> 
>> I cannot find pyplot.py anywhere on my disk. I can import matplotlib by
>> itself.
>> 
>> Is there another Ubuntu package I should install? Is anyone working on a
>> fix to the matplotlib ubuntu packages? If so, then does anyone know when
>> this may be resolved?
>> 
>> Any advice would be appreciated.
> 
> What version of matplotlib do you have?
> 
> 	import matplotlib
> 	print matplotlib.__version__
> 
> Ryan
> 
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/ImportError%3A-No-module-named-pyplot-tp21576482p21582333.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jeff W. <js...@fa...> - 2009年01月21日 12:27:31
wor...@ho... wrote:
> Dear Jeff.
>
> I'd like to modify or create gshhs_f.dat, gshhsmeta_f.dat using gshhs_f.b
>
> It takes long time to show full resolution basemap, and I want just a small_specific area.
>
> How can I modify basemap map data file?
>
> Any help would be appreciated.
>
> 
You can't modify that file - but if you can find an ESRI shapefile that 
has the coastlines for just the area you're interested in you can use that.
-Jeff
From: Sandro T. <mo...@de...> - 2009年01月21日 10:34:04
On Wed, Jan 21, 2009 at 04:23, mzs <ms...@th...> wrote:
>
> Hi,
>
> I am using Ubuntu Gutsy 7.10 and want to use matplotlib.pyplot but when I
> execute:
>
>> import matplotlib.pyplot as plt
>
> I get:
>
>>>> import matplotlib.plot as plt
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named plot
here you wrote "plot" not "pyplot": might this be the problem?
Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: Ryan M. <rm...@gm...> - 2009年01月21日 04:02:58
mzs wrote:
> Hi,
> 
> I am using Ubuntu Gutsy 7.10 and want to use matplotlib.pyplot but when I
> execute:
> 
>> import matplotlib.pyplot as plt
> 
> I get:
> 
>>>> import matplotlib.plot as plt
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named plot
> 
> I installed matplotlib using synaptic.
> 
> I found another reference to this problem on Google but no solution.
> 
> I cannot find pyplot.py anywhere on my disk. I can import matplotlib by
> itself.
> 
> Is there another Ubuntu package I should install? Is anyone working on a
> fix to the matplotlib ubuntu packages? If so, then does anyone know when
> this may be resolved?
> 
> Any advice would be appreciated.
What version of matplotlib do you have?
	import matplotlib
	print matplotlib.__version__
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: mzs <ms...@Th...> - 2009年01月21日 03:23:22
Hi,
I am using Ubuntu Gutsy 7.10 and want to use matplotlib.pyplot but when I
execute:
> import matplotlib.pyplot as plt
I get:
>>> import matplotlib.plot as plt
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named plot
I installed matplotlib using synaptic.
I found another reference to this problem on Google but no solution.
I cannot find pyplot.py anywhere on my disk. I can import matplotlib by
itself.
Is there another Ubuntu package I should install? Is anyone working on a
fix to the matplotlib ubuntu packages? If so, then does anyone know when
this may be resolved?
Any advice would be appreciated.
Thank you,
Marc
-- 
View this message in context: http://www.nabble.com/ImportError%3A-No-module-named-pyplot-tp21576482p21576482.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Sandro T. <mat...@gm...> - 2009年01月20日 23:32:44
Hello,
On Mon, Jan 19, 2009 at 19:32, Tim Michelsen
<tim...@gm...> wrote:
> Hello,
> are the nice examples from gallery on the matplotlib homepage somewhere
> available as a ZIP-archive?
>
> I would like to have them as reference during time I am not connected to
> the net.
In case you're using Debian (or a Debian-derived distribution) the
images, along with all the documentations distributed (see it like the
website) is available in the package python-matplotlib-doc (actually
in experimental).
Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: George N. <gn...@go...> - 2009年01月20日 23:08:10
Downloaded latest svn numpy and matplotlib and it works perfectly now.
Thanks for sorting it out so quickly.
George.
2009年1月20日 Eric Firing <ef...@ha...>:
> George Nurser wrote:
>>
>> I think there may be two bugs in quiver.
>
> Actually just 1...
>
>>
>> 1. Quiver doesn't seem to accept 1D arrays X and Y if they are
>> different sizes -- they need to be turned into 2d arrays with meshgrid
>> for the program to work. With line 13 uncommented I get the following
>> error message:
>
> This is a bug. It is fixed now in svn trunk and 98.5 maintenance branch.
>
>>
>> 2. Masking is not working properly with quiver, while it works fine
>> with contour -- see the attached quivtest.png
>
> This is a numpy.ma bug that has been fixed in numpy. I don't know exactly
> when it was fixed, but after I tracked it down to numpy.ma, I updated my
> copy of numpy from svn, and the problem went away. Somehow, when a
> multiplication was done with broadcasting, the mask was getting handled and
> propagated incorrectly. I suspect this bug was present only for a moderate
> interval of time, because quiver with masked points worked for a long time
> before you ran into the bug.
>
> Eric
>
From: Tim M. <tim...@gm...> - 2009年01月20日 22:59:46
Hello,
are the nice examples from gallery on the matplotlib homepage somewhere 
available as a ZIP-archive?
I would like to have them as reference during time I am not connected to 
the net.
Thanks and regards,
Timmie
From: Paul N. <pn...@il...> - 2009年01月20日 15:41:09
I am using matplotlib SVN revision 6810, and GSview 4.9 for Windows.
Paul
Michael Droettboom wrote:
> Which version of matplotlib and ghostscript are you using? With 
> matplotlib SVN trunk and gs 7.07, I can't reproduce this here, either 
> with your provided ps file or generating it myself.
> 
> Paul Novak wrote:
>> Hello,
>>
>> I am having some problems with the PS backend. I used the following
>> script to create a PostScript file
>>
>> #!/usr/bin/env python
>> import matplotlib
>> matplotlib.use('PS')
>> import matplotlib.pyplot as plt
>> import numpy
>>
>> x1 = numpy.arange(0,5)
>> y1 = x1
>> plt.plot(x1, y1)
>> plt.savefig('ps_backend.ps')
>> plt.show()
>>
>>
>> When I tried to open the PostScript file in GSview, there is the
>> following warning, and the file does not render properly. I have
>> attached the PostScript file and a screenshot of the incorrect rendering.
>>
>> DSC Error
>> At line 233:
>> %%Page: 1 1
>> This %%Page: line occurred in the trailer, which is not legal.
>> EPS files should be encapsulated in %%BeginDocument / %%EndDocument.
>> If is possible that an EPS file was incorrectly encapsulated,
>> and that we have been confused by the %%Trailer in an EPS file.
> Something is leading Ghostscript to believe this is an encapsulated 
> postscript file when it isn't. That's odd. Did you change the 
> extension of the file or something?
>>
>>
>> The error can be eliminated by removing the line with %%EOF at line 
>> 230, but I don't know anything about PostScript or if that change 
>> would have any other effects. I only found this solution after 
>> comparing with the output from the Cairo backend. The same change to 
>> PostScript output can be achieved with the following diff (from svn 
>> diff), but again, I don't know if it is appropriate.
>>
>> Index: ttconv/pprdrv_tt.cpp
>> ===================================================================
>> --- ttconv/pprdrv_tt.cpp (revision 6810)
>> +++ ttconv/pprdrv_tt.cpp (working copy)
>> @@ -1070,7 +1070,6 @@
>> } /* end of if Type 42 not understood. */
>>
>> stream.putline("FontName currentdict end definefont pop");
>> - stream.putline("%%EOF");
>> } /* end of ttfont_trailer() */
>>
>> /*------------------------------------------------------------------
> I'm surprised that this works, as the %%EOF comments are generally just 
> considered informational. But it doesn't hurt to remove this line (and 
> save 6 bytes per file!) so I'm fine with removing this line if we can 
> confirm this is the source of the error.
> 
> Mike
>>
>>
>> Paul Novak
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------ 
>>
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Simone G. <sim...@gm...> - 2009年01月20日 15:14:45
Sorry I made a mistake... what I mean is that I tryed the code in the
section "GUI neutral animation in pylab" from
http://www.scipy.org/Cookbook/Matplotlib/Animations, which is my
case... and, as I said, nothing is drawn in the window untill the
function ends the cycle, then the line is displayed
here is the code:
from pylab import *
import time
ion()
tstart = time.time() # for profiling
x = arange(0,2*pi,0.01) # x-array
line, = plot(x,sin(x))
for i in arange(1,200):
 line.set_ydata(sin(x+i/10.0)) # update the data
 draw() # redraw the canvas
print 'FPS:' , 200/(time.time()-tstart)
best regards,
simone
2009年1月20日 Simone Gabbriellini <sim...@gm...>:
> Ryan,
>
>> You'd want to look at the animation examples in examples/animation. The exact
>> details will depend upon what backend you want to use, but strip_chart_demo.py,
>> simple_anim_gtk.py, and gtk_timeout.py are good places to start.
>
> I tried the strip_chart_demo.py, which is my case, but at least on my
> Mac OSX system, I don't see anything untill the plot is finished...
>
> Simone
>
From: Simone G. <sim...@gm...> - 2009年01月20日 15:03:47
Ryan,
> You'd want to look at the animation examples in examples/animation. The exact
> details will depend upon what backend you want to use, but strip_chart_demo.py,
> simple_anim_gtk.py, and gtk_timeout.py are good places to start.
I tried the strip_chart_demo.py, which is my case, but at least on my
Mac OSX system, I don't see anything untill the plot is finished...
Simone
From: John H. <jd...@gm...> - 2009年01月20日 14:33:36
On Tue, Jan 20, 2009 at 7:17 AM, Michael Droettboom <md...@st...> wrote:
> My understanding is that that behavior is deliberate. If the tick
> labels are changed to something completely arbitrary, how can the
> toolbar know what to display?
>
> Mike
>
> Michael Dovrat wrote:
>> I have noticed that in the NavigationToolbar2QT there is a small
>> display of x,y coordinates at the rightmost corner of the toolbar.
>>
>> However, when using Axes.set_ticklabels, for example, to normalize
>> through the labels and not through the data itself or to make a
>> reciprocal scale - set locations and labels, the display of
>> coordinates is lost.
>>
>> I have attached the example "embedding in qt4" with minimal additions
>> to show this.
>> Notice how the x coordinate is still alive in the bottom toolbar,
>> while the y coordinate isn't.
>>
>> I haven't found any way in the documentation to tell the navigation
>> toolbar anything related to this change.
>>
>> This isn't crucial in any way, just a pity that it is not working
>> properly.
There are some cases where we could be smarter about this, notably the
case you mention and when we are using date formatters. The essence
of the problem is that mpl uses the matplotlib.ticker.Formatter
instance, the thing that converts values to strings for the tick
locations, for the navigation toolbar. When you specify fixed labels,
we use a special Formatter to convert those locations to the specified
strings. If you mouse over a region where there is a tick, you will
probably see the toolbar flash the tick label.
The easiest workaround is to set the fmt_xdata and fmt_ydata
attributes of the axes. Eg::
 ax.fmt_xdata = lambda x: '%1.4f'%x
Then your toolbar will format the x location with 4 digits of precision.
JDH
From: Michael D. <md...@st...> - 2009年01月20日 13:46:12
Can you provide any more information, such as your f2py module? How are 
you passing the array to/from Python? Perhaps it is getting destroyed 
(dereferenced to the point of it being deleted by the Python 
interpreter) and you're re-using a dangling pointer?
Mike
George Nurser wrote:
> I am finding a very strange error.
>
> I have a program that integrates a partial differential equation using
> fortran code in an f2py module. Data in arrays held in the f2py module
> is updated in the fortran code. The module arrays are exposed to
> python (but not changed by python code). After each increment of
> timestep the array is plotted using matplotlib, and a figure saved
> with savefig, so as to create an animation.
>
> What I am finding is that the fortran module array is becoming
> corrupted with NaNs.
>
> If, however, I simply comment out the call to savefig in my python
> code, there is no corruption of the module arrays.
>
> WxAgg backend, Intel Mac OS 10.5.6, python 2.5.2, matplotlib svn
> revision 6739, numpy 1.3.0.dev6297
>
> I have the same problem with GtkAgg python 2.5.1 + matplotlib svn
> 6757.+ numpy 1.3.0.dev6297 on suse linux 10.1, amd_64.
>
> George Nurser.
>
>
>
> .
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2009年01月20日 13:41:06
Which version of matplotlib and ghostscript are you using? With 
matplotlib SVN trunk and gs 7.07, I can't reproduce this here, either 
with your provided ps file or generating it myself.
Paul Novak wrote:
> Hello,
>
> I am having some problems with the PS backend. I used the following
> script to create a PostScript file
>
> #!/usr/bin/env python
> import matplotlib
> matplotlib.use('PS')
> import matplotlib.pyplot as plt
> import numpy
>
> x1 = numpy.arange(0,5)
> y1 = x1
> plt.plot(x1, y1)
> plt.savefig('ps_backend.ps')
> plt.show()
>
>
> When I tried to open the PostScript file in GSview, there is the
> following warning, and the file does not render properly. I have
> attached the PostScript file and a screenshot of the incorrect rendering.
>
> DSC Error
> At line 233:
> %%Page: 1 1
> This %%Page: line occurred in the trailer, which is not legal.
> EPS files should be encapsulated in %%BeginDocument / %%EndDocument.
> If is possible that an EPS file was incorrectly encapsulated,
> and that we have been confused by the %%Trailer in an EPS file.
Something is leading Ghostscript to believe this is an encapsulated 
postscript file when it isn't. That's odd. Did you change the 
extension of the file or something?
>
>
> The error can be eliminated by removing the line with %%EOF at line 
> 230, but I don't know anything about PostScript or if that change 
> would have any other effects. I only found this solution after 
> comparing with the output from the Cairo backend. The same change to 
> PostScript output can be achieved with the following diff (from svn 
> diff), but again, I don't know if it is appropriate.
>
> Index: ttconv/pprdrv_tt.cpp
> ===================================================================
> --- ttconv/pprdrv_tt.cpp (revision 6810)
> +++ ttconv/pprdrv_tt.cpp (working copy)
> @@ -1070,7 +1070,6 @@
> } /* end of if Type 42 not understood. */
>
> stream.putline("FontName currentdict end definefont pop");
> - stream.putline("%%EOF");
> } /* end of ttfont_trailer() */
>
> /*------------------------------------------------------------------
I'm surprised that this works, as the %%EOF comments are generally just 
considered informational. But it doesn't hurt to remove this line (and 
save 6 bytes per file!) so I'm fine with removing this line if we can 
confirm this is the source of the error.
Mike
>
>
> Paul Novak
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2009年01月20日 13:17:53
My understanding is that that behavior is deliberate. If the tick 
labels are changed to something completely arbitrary, how can the 
toolbar know what to display?
Mike
Michael Dovrat wrote:
> I have noticed that in the NavigationToolbar2QT there is a small 
> display of x,y coordinates at the rightmost corner of the toolbar.
>
> However, when using Axes.set_ticklabels, for example, to normalize 
> through the labels and not through the data itself or to make a 
> reciprocal scale - set locations and labels, the display of 
> coordinates is lost.
>
> I have attached the example "embedding in qt4" with minimal additions 
> to show this.
> Notice how the x coordinate is still alive in the bottom toolbar, 
> while the y coordinate isn't.
>
> I haven't found any way in the documentation to tell the navigation 
> toolbar anything related to this change.
>
> This isn't crucial in any way, just a pity that it is not working 
> properly.
>
> Miki
>
> My operating system is Windows XP.
> matplotlib version 0.98.5.2 on python 2.5 installed by the standard 
> binary installer.
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Ryan M. <rm...@gm...> - 2009年01月20日 02:19:55
Simone Gabbriellini wrote:
> I see that you first build your array and then display it at the end...
> 
> is it possible in matplotlib to update the plot while the class is
> evolving? like:
> 
> f.evolve(6)
> f.display()
> f.evolve(.27)
> f.display()
> f.evolve(10)
> f.display()
> f.evolve(2)
> f.display()
You'd want to look at the animation examples in examples/animation. The exact
details will depend upon what backend you want to use, but strip_chart_demo.py,
simple_anim_gtk.py, and gtk_timeout.py are good places to start.
HTH,
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Eric F. <ef...@ha...> - 2009年01月20日 02:16:11
George Nurser wrote:
> I think there may be two bugs in quiver.
Actually just 1...
> 
> 1. Quiver doesn't seem to accept 1D arrays X and Y if they are
> different sizes -- they need to be turned into 2d arrays with meshgrid
> for the program to work. With line 13 uncommented I get the following
> error message:
This is a bug. It is fixed now in svn trunk and 98.5 maintenance branch.
> 
> 2. Masking is not working properly with quiver, while it works fine
> with contour -- see the attached quivtest.png
This is a numpy.ma bug that has been fixed in numpy. I don't know 
exactly when it was fixed, but after I tracked it down to numpy.ma, I 
updated my copy of numpy from svn, and the problem went away. Somehow, 
when a multiplication was done with broadcasting, the mask was getting 
handled and propagated incorrectly. I suspect this bug was present only 
for a moderate interval of time, because quiver with masked points 
worked for a long time before you ran into the bug.
Eric
From: antonv <vas...@ya...> - 2009年01月20日 00:22:06
Hi Pierre,
Thanks for the quick and thorough response!
What I ended up doing is writing a custom function that does all the stuff
that I needed without using numpy or mlab. 
Anton
Pierre GM-2 wrote:
> 
> Anton,
> You may wanna check on the numpy list as well.
> I recently reimplemented a function to read text file as a combination 
> of numpy.loadtxt and mlab.csv2rec, that handles missing data nicely. 
> You can get it here for the moment:
> https://code.launchpad.net/~pierregm/numpy/numpy_addons
> The function you would need is mafromtxt, in fromascii. Alternatively, 
> you can try using the scikits.timeseries package
> (http://pytseries.sourceforge.net/ 
> ): recent SVN versions introduced tsfromtxt, that read a text file and 
> return a timeseries.
> 
> However, none of these possibilities will work out-of-the-box, because 
> of the presence of the footer. What you could do is write a first 
> function that gets rid of this footer (example of MO: open the file, 
> read all the lines in a list, get rid of the first 7 rows (header) and 
> last 8 ones, store the result in a file). Once you have only the data, 
> use mafromtxt (for example) using space as a delimiter, and specify 
> the columns you want to use with usecols (that way, you can get rid of 
> the column with the '*'). The missing data should be taken into 
> account properly.
> 
> Let me know how it goes.
> P.
> 
> 
> 
> On Jan 17, 2009, at 2:16 AM, antonv wrote:
> 
>>
>> Dear all,
>>
>> I know this is not related to matplotlib but this seems to be the 
>> only place
>> where I found people that have knowledge of both NOAA data and 
>> python so
>> please bear with me.
>>
>> The .bull file that NOAA gives for upload is an ascii file formatted 
>> for
>> human readability but it creates a lot of issues when I am trying to 
>> parse
>> it. Here is a link to one of these files:
>>
>> ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20090117/bulls.t00z/akw.46001.bull
>>
>> Do you have any idea on how to extract the data there in columns for
>> plotting with matplotlib? If you look at the file you'll notice that 
>> there
>> is both a header and a footer for the file that needs to be 
>> eliminated and
>> the main columns have sub columns also. Another issue is that in a 
>> column
>> there is missing data that should keep it's relationship with the time
>> column. And the last issue, some of the values there are preceded by 
>> a "*"
>> sign that should just be removed too.
>>
>> Any ideas are greatly appreciated!
>>
>> Anton
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/NOAA-.bull-file-parsing-tp21513800p21513800.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/NOAA-.bull-file-parsing-tp21513800p21554671.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2009年01月19日 23:42:53
George Nurser wrote:
> I think there may be two bugs in quiver.
Thanks for the report. I can reproduce both problems, and I will try to 
solve them.
Eric
> 
> 1. Quiver doesn't seem to accept 1D arrays X and Y if they are
> different sizes -- they need to be turned into 2d arrays with meshgrid
> for the program to work. With line 13 uncommented I get the following
> error message:
> 
> File "quivtest.py", line 13, in <module>
> ax.quiver(XT,YT,uu,vv) #fails
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py",
> line 5533, in quiver
> q = mquiver.Quiver(self, *args, **kw)
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/quiver.py",
> line 343, in __init__
> self.XY = np.hstack((X[:,np.newaxis], Y[:,np.newaxis]))
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/shape_base.py",
> line 488, in hstack
> return _nx.concatenate(map(atleast_1d,tup),1)
> ValueError: array dimensions must agree except for d_0
> 
> 2. Masking is not working properly with quiver, while it works fine
> with contour -- see the attached quivtest.png
> 
> quiver.py:
> 
> import numpy as np
> import numpy.ma as ma
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
> XT = np.arange(10.)
> YT = np.arange(20.)
> uu = np.zeros([20,10])+7.
> vv = np.zeros([20,10])+3.
> 
> fig = plt.figure()
> ax = fig.add_subplot(121)
> # ax.quiver(XT,YT,uu,vv) #fails
> XX,YY = np.meshgrid(XT,YT)
> ax.quiver(XX,YY,uu,vv) #Ok
> 
> ax = fig.add_subplot(122)
> msk = XX**2+YY**2 >50
> uumsk = ma.masked_array(uu,mask=msk)
> vvmsk = ma.masked_array(vv,mask=msk)
> ax.contour(XT,YT,uumsk*XX) # works
> ax.quiver(XX,YY,uumsk,vvmsk) # gives strange shapes
> plt.show()
> fig.savefig('quivtest.png',dpi=100)
> 
> George Nurser.
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: George N. <gn...@go...> - 2009年01月19日 23:05:54
I am finding a very strange error.
I have a program that integrates a partial differential equation using
fortran code in an f2py module. Data in arrays held in the f2py module
is updated in the fortran code. The module arrays are exposed to
python (but not changed by python code). After each increment of
timestep the array is plotted using matplotlib, and a figure saved
with savefig, so as to create an animation.
What I am finding is that the fortran module array is becoming
corrupted with NaNs.
If, however, I simply comment out the call to savefig in my python
code, there is no corruption of the module arrays.
WxAgg backend, Intel Mac OS 10.5.6, python 2.5.2, matplotlib svn
revision 6739, numpy 1.3.0.dev6297
I have the same problem with GtkAgg python 2.5.1 + matplotlib svn
6757.+ numpy 1.3.0.dev6297 on suse linux 10.1, amd_64.
George Nurser.
.
From: George N. <gn...@go...> - 2009年01月19日 22:32:23
Attachments: quivtest.png
I think there may be two bugs in quiver.
1. Quiver doesn't seem to accept 1D arrays X and Y if they are
different sizes -- they need to be turned into 2d arrays with meshgrid
for the program to work. With line 13 uncommented I get the following
error message:
 File "quivtest.py", line 13, in <module>
 ax.quiver(XT,YT,uu,vv) #fails
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py",
line 5533, in quiver
 q = mquiver.Quiver(self, *args, **kw)
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/quiver.py",
line 343, in __init__
 self.XY = np.hstack((X[:,np.newaxis], Y[:,np.newaxis]))
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/shape_base.py",
line 488, in hstack
 return _nx.concatenate(map(atleast_1d,tup),1)
ValueError: array dimensions must agree except for d_0
2. Masking is not working properly with quiver, while it works fine
with contour -- see the attached quivtest.png
quiver.py:
import numpy as np
import numpy.ma as ma
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
XT = np.arange(10.)
YT = np.arange(20.)
uu = np.zeros([20,10])+7.
vv = np.zeros([20,10])+3.
fig = plt.figure()
ax = fig.add_subplot(121)
# ax.quiver(XT,YT,uu,vv) #fails
XX,YY = np.meshgrid(XT,YT)
ax.quiver(XX,YY,uu,vv) #Ok
ax = fig.add_subplot(122)
msk = XX**2+YY**2 >50
uumsk = ma.masked_array(uu,mask=msk)
vvmsk = ma.masked_array(vv,mask=msk)
ax.contour(XT,YT,uumsk*XX) # works
ax.quiver(XX,YY,uumsk,vvmsk) # gives strange shapes
plt.show()
fig.savefig('quivtest.png',dpi=100)
George Nurser.
From: Paul N. <pn...@il...> - 2009年01月19日 18:56:40
Hello,
I am having some problems with the PS backend. I used the following
script to create a PostScript file
#!/usr/bin/env python
import matplotlib
matplotlib.use('PS')
import matplotlib.pyplot as plt
import numpy
x1 = numpy.arange(0,5)
y1 = x1
plt.plot(x1, y1)
plt.savefig('ps_backend.ps')
plt.show()
When I tried to open the PostScript file in GSview, there is the
following warning, and the file does not render properly. I have
attached the PostScript file and a screenshot of the incorrect rendering.
DSC Error
At line 233:
 %%Page: 1 1
This %%Page: line occurred in the trailer, which is not legal.
EPS files should be encapsulated in %%BeginDocument / %%EndDocument.
If is possible that an EPS file was incorrectly encapsulated,
and that we have been confused by the %%Trailer in an EPS file.
The error can be eliminated by removing the line with %%EOF at line 230, 
but I don't know anything about PostScript or if that change would have 
any other effects. I only found this solution after comparing with the 
output from the Cairo backend. The same change to PostScript output can 
be achieved with the following diff (from svn diff), but again, I don't 
know if it is appropriate.
Index: ttconv/pprdrv_tt.cpp
===================================================================
--- ttconv/pprdrv_tt.cpp	(revision 6810)
+++ ttconv/pprdrv_tt.cpp	(working copy)
@@ -1070,7 +1070,6 @@
 	} /* end of if Type 42 not understood. */
 stream.putline("FontName currentdict end definefont pop");
- stream.putline("%%EOF");
 } /* end of ttfont_trailer() */
 /*------------------------------------------------------------------
Paul Novak
From: Gideon S. <si...@ma...> - 2009年01月19日 16:15:31
Examples of the tex_demo.py from the matplotlib website. One is 
generated with the OS X backend and the other with the Qt4 backend.
From: Romain B. <ro...@pe...> - 2009年01月19日 15:12:58
Hello,
This code worked with matplotlib 0.87:
 fig = Figure()
 ax = fig.add_subplot(121)
 width = 0.5 # the width of the bars
 self.dpi = 70
 yoff = array([0.0] * len(self.__labels)) # the bottom values for stacked bar chart
 self.__bars = ()
 for row in xrange(rows):
 	self.__bars += (ax.bar(ind, self.__data[row], width, bottom=yoff, color=colours),)
 	yoff = yoff + self.__data[row]
 
 #...
 fig.set_size_inches(self.size[0], self.size[1])
 imdata=StringIO()
 fig.savefig(imdata,format='png', dpi=self.dpi)
 self.__image = imdata.getvalue()
 self.height = fig.get_figheight()* self.dpi
 #...
 coords = []
 
 for bar in self.__bars:
 x1 = []
 y1 = []
 x2 = []
 y2 = []
 # For each bars, we get values of rectangles
 for b in bar:
 x1 += [b.get_x(),]
 y1 += [b.get_y(),]
 if matplotlib.compare_versions(matplotlib.__version__, '0.97'):
 x2 += [b.get_x() + b.get_width(),]
 y2 += [b.get_y() + b.get_height(),]
 else:
 x2 += [b.get_x() + b.width,]
 y2 += [b.get_y() + b.height,]
 
 if matplotlib.compare_versions(matplotlib.__version__, '0.97'):
 xys1 = zip(x1, y1)
 xys2 = zip(x2, y2)
 # We get the top left points for each bars...
 xys1 = bar[0].get_transform().transform(xys1)
 # ...and the bottom right points for each bars.
 xys2 = bar[0].get_transform().transform(xys2)
 else:
 xys1 = zip(bar[0].get_transform().seq_x_y(x1, y1))
 xys2 = zip(bar[0].get_transform().seq_x_y(x2, y2))
 
 # Now for each bars, we can make a (x,y,w,h) data coords for HTML map area.
 for (sx1, sy1), (sx2, sy2) in zip(xys1, xys2):
 coords.append(sx1, self.height - sy2, sx2, self.height))
 #...then coords is used to build the html area tags
Where it works with matplotlib 0.87, the behavior isn't correct with matplotlib 0.98.
There are some version tests to run correctly compatible code. Blocks are
equivalents, but as the v0.87 code works, the v0.98 code doesn't produce the
same behavior.
For example, if xys1 and xys2 are:
xys1 = [(0.0, 0.0), (0.5, 0.0), (1.0, 0.0), (1.5, 0.0), (2.0, 0.0), (2.5, 0.0), (3.0, 0.0), (3.5, 0.0), (4.0, 0.0), (4.5, 0.0)]
xys2 = [(0.5, 992.0), (1.0, 1025.0), (1.5, 972.0), (2.0, 1004.0), (2.5, 1007.0), (3.0, 1004.0), (3.5, 974.0), (4.0, 995.0), (4.5, 981.0), (5.0, 964.0)]
The arrays produced by the transform() methods will be:
xys1 = [[ 50. 20. ]
 [ 65.5 20. ]
 [ 81. 20. ]
 [ 96.5 20. ]
 [ 112. 20. ]
 [ 127.5 20. ]
 [ 143. 20. ]
 [ 158.5 20. ]
 [ 174. 20. ]
 [ 189.5 20. ]]
xys2 = [[ 6.55000000e+01 1.31228533e+05]
 [ 8.10000000e+01 1.35593333e+05]
 [ 9.65000000e+01 1.28583200e+05]
 [ 1.12000000e+02 1.32815733e+05]
 [ 1.27500000e+02 1.33212533e+05]
 [ 1.43000000e+02 1.32815733e+05]
 [ 1.58500000e+02 1.28847733e+05]
 [ 1.74000000e+02 1.31625333e+05]
 [ 1.89500000e+02 1.29773600e+05]
 [ 2.05000000e+02 1.27525067e+05]]
Firstly, the horizontal axe is separated with 15.5 points, but on picture, 28 
are needed.
Then, vertical values are around 1.0e+05, but self.height=175!
Is there any matplotlib behavior changed in new versions?
Thanks, regards
-- 
Romain Bignon -- http://romain.peerfuse.org
http://peerfuse.org
From: Jeff W. <js...@fa...> - 2009年01月19日 14:41:46
Einar M. Einarsson wrote:
> Hi all.
>
> is it not possible to extend plot outside of a plot area? To 
> illustrate what I want
> to do take for example the wind barbs example from the matplotlib 
> gallery.
> (see below)
>
> I only changed line 23 from ax.barbs(X, Y, U, V) to ax.barbs(X, Y, - 
> U, -V)
>
> But now we don't see the tail of the barbs in the first subplot.
>
> So Is it possible to let matplotlib plot the tail, without extending 
> the axes?
> 
Einar: You can use the set_clip_box method of the barbs instance to 
turn clipping off:
bb = ax.barbs(X, Y, -U, -V)
bb.set_clip_box(None)
-Jeff
> Best Regards
> Einar M. Einarsson
>
> '''
> Demonstration of wind barb plots
> '''
> import matplotlib.pyplot as plt
> import numpy as np
>
> x = np.linspace(-5, 5, 5)
> X,Y = np.meshgrid(x, x)
> U, V = 12*X, 12*Y
>
> data = [(-1.5, .5, -6, -6),
> (1, -1, -46, 46),
> (-3, -1, 11, -11),
> (1, 1.5, 80, 80),
> (0.5, 0.25, 25, 15),
> (-1.5, -0.5, -5, 40)]
>
> data = np.array(data, dtype=[('x', np.float32), ('y', np.float32),
> ('u', np.float32), ('v', np.float32)])
>
> #Default parameters, uniform grid
> ax = plt.subplot(2,2,1)
> ax.barbs(X, Y, -U, -V)
>
> #Arbitrary set of vectors, make them longer and change the pivot point
> #(point around which they're rotated) to be the middle
> ax = plt.subplot(2,2,2)
> ax.barbs(data['x'], data['y'], data['u'], data['v'], length=8, 
> pivot='middle')
>
> #Showing colormapping with uniform grid. Fill the circle for an 
> empty barb,
> #don't round the values, and change some of the size parameters
> ax = plt.subplot(2,2,3)
> ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, 
> rounding=False,
> sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3))
>
> #Change colors as well as the increments for parts of the barbs
> ax = plt.subplot(2,2,4)
> ax.barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r',
> barbcolor=['b','g'], barb_increments=dict(half=10, full=20, 
> flag=100),
> flip_barb=True)
>
> plt.show()
>
>
> 
2 messages has been excluded from this view by a project administrator.

Showing results of 498

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