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



Showing results of 148

<< < 1 .. 3 4 5 6 > >> (Page 5 of 6)
From: John W. <jd...@go...> - 2004年03月08日 16:16:19
Another clue, when I try another example with wx I get:
wohlbier@gyrotwystron examples $ python dynamic_demo_wx.py
Traceback (most recent call last):
 File "dynamic_demo_wx.py", line 34, in ?
 from matplotlib.backends import Figure, Toolbar, FigureManager
ImportError: cannot import name Figure
wohlbier@gyrotwystron examples $
Does this mean anything?
jgw
>
> John> I get the error even using 0.51. Maybe my wxPython is
> John> broken. Do you know of a way I can test it?
>
> The example runs fine on my systm.
>
> Something funny is going on. wx does not attempt to load mathtext,
> either in 0.51 or in CVS. That, and the fact that you are getting a
> gthread error, make me suspect you are actually loading the gtk
> backend.
>
> Are you trying to run embedding_in_wx from the prompt or from a
> development environment such as pycrust? If you run from the prompt,
> you shouldn't see that error. If not, you may be loading the default
> backend (GTK) first in your development environment and then trying to
> run embedding_in_wx.
>
> For example, if you first import matplotlib and later try to run
> embedding_in_wx in the same python/pycrust session, you will get
> yourself into a world of trouble, since the default import loads GTK and
> the second one WX. These two cannot peacefully coexist.
>
> Try running the examples from the linux shell or DOS prompt first. Have
> you read the information about how to select the various backends on
> http://matplotlib.sourceforge.net/backends.html?
>
> You can change your default backend (eg to WX) in you .matplotlibrc
> file.
>
> http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC
> http://matplotlib.sourceforge.net/.matplotlibrc
>
> If you still encounter problems, please tell me exactly what you are
> doing: what platform, how you are trying to run the example etc...
>
> Hope this helps,
> JDH
From: John W. <jd...@go...> - 2004年03月08日 16:09:34
I have been running from the prompt all along. The command line is:
wohlbier@gyrotwystron examples $ python embedding_in_wx.py
Could not import mathtext (build with ft2font)
GThread-ERROR **: GThread system may only be initialized once.
aborting...
Aborted
wohlbier@gyrotwystron examples $
If running from the command line, does .matplotlibrc make a difference?
I did set the default backend in this file to WX.
I am on gentoo linux, python 2.3.3, wxPython 2.4.1.2, matplotlib 0.51,
executing from the command line as above, from the directory
/usr/lib/python2.3/site-packages/matplotlib-0.51/examples/
Let me know if you need something more about my setup.
jgw
> John> I get the error even using 0.51. Maybe my wxPython is
> John> broken. Do you know of a way I can test it?
>
> The example runs fine on my systm.
>
> Something funny is going on. wx does not attempt to load mathtext,
> either in 0.51 or in CVS. That, and the fact that you are getting a
> gthread error, make me suspect you are actually loading the gtk
> backend.
>
> Are you trying to run embedding_in_wx from the prompt or from a
> development environment such as pycrust? If you run from the prompt,
> you shouldn't see that error. If not, you may be loading the default
> backend (GTK) first in your development environment and then trying to
> run embedding_in_wx.
>
> For example, if you first import matplotlib and later try to run
> embedding_in_wx in the same python/pycrust session, you will get
> yourself into a world of trouble, since the default import loads GTK and
> the second one WX. These two cannot peacefully coexist.
>
> Try running the examples from the linux shell or DOS prompt first. Have
> you read the information about how to select the various backends on
> http://matplotlib.sourceforge.net/backends.html?
>
> You can change your default backend (eg to WX) in you .matplotlibrc
> file.
>
> http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC
> http://matplotlib.sourceforge.net/.matplotlibrc
>
> If you still encounter problems, please tell me exactly what you are
> doing: what platform, how you are trying to run the example etc...
>
> Hope this helps,
> JDH
From: John H. <jdh...@ac...> - 2004年03月08日 15:50:20
>>>>> "John" == John Wohlbier <jd...@go...> writes:
 John> I get the error even using 0.51. Maybe my wxPython is
 John> broken. Do you know of a way I can test it?
The example runs fine on my systm.
Something funny is going on. wx does not attempt to load mathtext,
either in 0.51 or in CVS. That, and the fact that you are getting a
gthread error, make me suspect you are actually loading the gtk
backend. 
Are you trying to run embedding_in_wx from the prompt or from a
development environment such as pycrust? If you run from the prompt,
you shouldn't see that error. If not, you may be loading the default
backend (GTK) first in your development environment and then trying to
run embedding_in_wx. 
For example, if you first import matplotlib and later try to run
embedding_in_wx in the same python/pycrust session, you will get
yourself into a world of trouble, since the default import loads GTK
and the second one WX. These two cannot peacefully coexist.
Try running the examples from the linux shell or DOS prompt first.
Have you read the information about how to select the various backends
on http://matplotlib.sourceforge.net/backends.html?
You can change your default backend (eg to WX) in you .matplotlibrc
file.
 http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC
 http://matplotlib.sourceforge.net/.matplotlibrc
If you still encounter problems, please tell me exactly what you are
doing: what platform, how you are trying to run the example etc...
Hope this helps,
JDH
From: John W. <jd...@go...> - 2004年03月08日 15:38:39
I get the error even using 0.51. Maybe my wxPython is
broken. Do you know of a way I can test it?
Thanks.
jgw
>John> I am using the latest CVS release of matplotlib from
>John> sourceforge, and when I try to run the wx backend example I
>John> get
>
>John> gyrotwystron examples # python embedding_in_wx.py Could not
>John> import mathtext (build with ft2font)
>
>John> GThread-ERROR **: GThread system may only be initialized John>
> once. aborting... Aborted
>
>John> The gtk backend examples work fine (although I still get the
>John> mathtext warning). I have python 2.3 and wxPython 2.4.2.4 on
>John> a gentoo linux system.
>
> Not sure why you get this - Jeremy may be working on porting mathtext to
> WX. The 0.51 release is quite current, so unless you are looking for a
> specific feature from CVS I suggest you use that distribution since
> there are extra problems you'll encounter trying to build from CVS (see
> my last response to Andrew for details).
>
> If you want to clear up the cannot import mathtext problem, set
> BUILD_FT2FONT to True in setup.py before building.
>
> JDH
From: John H. <jdh...@ac...> - 2004年03月08日 15:15:59
>>>>> "Jim" == Jim Benson <jb...@se...> writes:
 Jim> ...it worked great. I closed the plot...and tried it again.
 Jim> Here is what happened:
 .... snip ....
 Jim> line 121, in show self.window.deiconify() File
 Jim> "/usr/local/lib/python2.3/lib-tk/Tkinter.py", line 1412, in
 Jim> wm_deiconify return self.tk.call('wm', 'deiconify', self._w)
 Jim> _tkinter.TclError: can't invoke "wm" command: application has
 Jim> been destroyed
 >>>>
 Jim> Should i be doing something different if i want to make
 Jim> multiple plots in interactive mode? I also tried using a
 Jim> figure(i) command before the plot command...this works
 Jim> fine...unless i try to reuse a previously closed i-th figure.
Several people have experienced problems along these lines, and we're
working on a fix. This was the first release of the Tk backend so
please keep us up to date on other problems you find. Using the "close"
command instead of clicking the x to close the window should work
>>> from matplotlib.matlab import *
>>> plot([1,2,3])
>>> close()
>>> plot([1,2,3])
Or you can use multiple figures at the same time with the figure
command
>>> from matplotlib.matlab import *
>>> figure(1)
>>> plot([1,2,3])
>>> figure(2)
>>> plot([1,2,3])
>>> close(2)
>>> xlabel('time') # figure 1 is active
Thanks,
JDH
From: Jim B. <jb...@se...> - 2004年03月08日 01:11:43
Hi,
 I'm a matplotlib (great package!) newbie. I decided to give the 
new TkAgg interactive mode a try. I did the setup
then tried the example:
>>> from matplotlib.matlab import *
>>> plot([1,2,3])
>>> xlabel('hi mom')
...it worked great. I closed the plot...and tried it again.
Here is what happened:
floyd:/home/jbenson/python>python
Python 2.3.3 (#1, Dec 21 2003, 15:13:18)
[GCC 3.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib.matlab import *
>>> plot([1,2,3]) # This plot looked fine
Could not find requested font Times
Please set environment var TTFPATH to point to your true type fonts 
(*.ttf)
Could not find Times; falling back on Vera
[<matplotlib.lines.Line2D instance at 0x42c2b20c>]
>>> plot([1,2,3])
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py", line 
788, in plot
 draw_if_interactive()
 File 
"/usr/local/lib/python2.3/site-packages/matplotlib/backends/backend_tkagg.py", 
line 46, in draw_if_interactive
 figManager.show()
 File 
"/usr/local/lib/python2.3/site-packages/matplotlib/backends/backend_tkagg.py", 
line 121, in show
 self.window.deiconify()
 File "/usr/local/lib/python2.3/lib-tk/Tkinter.py", line 1412, in 
wm_deiconify
 return self.tk.call('wm', 'deiconify', self._w)
_tkinter.TclError: can't invoke "wm" command: application has been 
destroyed
>>>
Should i be doing something different if i want to make multiple
plots in interactive mode? I also tried using a figure(i) command
before the plot command...this works fine...unless i try to reuse
a previously closed i-th figure.
Thanks,
Jim
 
From: Andrew S. <str...@as...> - 2004年03月07日 04:22:03
John Hunter wrote:
> Andrew> Also, this is
> Andrew> using the version of matplotlib I checked out with CVS.
> Andrew> This version fails to build the agg backend with:
>
> Andrew> running build_py package init file 'ttfquery/__init__.py'
> Andrew> not found (or not a regular file) package init file
> Andrew> 'FontTools/__init__.py' not found (or not a regular file)
> Andrew> package init file 'FontTools/fontTools/__init__.py' not
> Andrew> found (or not a regular file) package init file
> Andrew> 'FontTools/fontTools/encodings/__init__.py' not found (or
> Andrew> not a regular file) error: package directory
> Andrew> 'FontTools/fontTools/misc' does not exist
>
> I won't get a chance to look at your fill code til Monday (which BTW
> is something I've been wanting to add for a while), but the main
> problem here is that CVS doesn't have a complete version of the
> FontTools* and ttf* that are needed to build from src. The 0.51
> release is actually quite up to date and you would probably be best
> off just working in that tree for now. vis-a-vis FontTools and
> ttfquery - an increasing number of matplotlib backends need ttf font
> finding capabilitlities which FontTools and ttfquery provide.
> However, they are big and a pain to install and Paul Barrett has been
> working on a replacement. At one point I added them to CVS since I
> was distributing them with matplotlib but thought twice about it and
> tried to remove them. However despite multiple attempts I have not
> been able to get them out of CVS (a free beer to anyone with commit
> privs who can purge these bastards). No in a nutshell there is an
> incomplete version of FontTools and ttfquery in CVS.
This is one of the downsides of CVS; it doesn't deal with directories 
very well (or at all). A SourceForge support request would be required 
for one of their admins to go into CVSROOT and manually do this.
What's wrong with distributing them via CVS, at least while they're 
distributed in the officially released matplotlib sources? It would 
made things a bit cleaner for those willing to live on the bleeding 
edge. (Then again, I suppose those willing to live on the bleeding 
edge are probably also be happy copy a few directories around, too. At 
least as long as we know what to do.)
> If you want to build from CVS, copy the agg, FontTools* and ttfquery
> dirs/files from the 0.51 src distro into the CVS tree and build from
> there.
Works like a charm!
Cheers!
Andrew
From: John H. <jdh...@ac...> - 2004年03月06日 16:33:03
>>>>> "John" == John Wohlbier <jd...@go...> writes:
 John> I am using the latest CVS release of matplotlib from
 John> sourceforge, and when I try to run the wx backend example I
 John> get
 John> gyrotwystron examples # python embedding_in_wx.py Could not
 John> import mathtext (build with ft2font)
 John> GThread-ERROR **: GThread system may only be initialized
 John> once. aborting... Aborted
 John> The gtk backend examples work fine (although I still get the
 John> mathtext warning). I have python 2.3 and wxPython 2.4.2.4 on
 John> a gentoo linux system.
Not sure why you get this - Jeremy may be working on porting mathtext
to WX. The 0.51 release is quite current, so unless you are looking
for a specific feature from CVS I suggest you use that distribution
since there are extra problems you'll encounter trying to build from
CVS (see my last response to Andrew for details).
If you want to clear up the cannot import mathtext problem, set
BUILD_FT2FONT to True in setup.py before building.
JDH
From: John H. <jdh...@ac...> - 2004年03月06日 16:28:45
>>>>> "Andrew" == Andrew Straw <str...@as...> writes:
 Andrew> G'day all! I'm back to using matplotlib after a few
 Andrew> months away. I'm very impressed with the recent progress!
Thanks. It's good to see you back around in these parts :-)
 Andrew> I often plot the instantaneous variance of repeated
 Andrew> recordings made under the same conditions using a shaded
 Andrew> area to surround the mean. I'm trying to find a way to do
 Andrew> this with matplotlib. Included below is a "filly" (fill
 Andrew> y) function I wrote to attempt to do this. It doesn't
 Andrew> quite work yet, and I'd like some help. (BTW, I don't
 Andrew> know of how this would be done in Matlab, so if there's a
 Andrew> more compatible way, I'd be happy to change the approach.)
 Andrew> 1) How do I make the data fill the axes automatically,
 Andrew> such as the "plot" function?
 Andrew> 2) Is it a bug that the polygon is not filled, or am I
 Andrew> missing something?
 Andrew> I've only tried this in the PS backend -- I'm having
 Andrew> troubles with the others at the moment. Also, this is
 Andrew> using the version of matplotlib I checked out with CVS.
 Andrew> This version fails to build the agg backend with:
 Andrew> running build_py package init file 'ttfquery/__init__.py'
 Andrew> not found (or not a regular file) package init file
 Andrew> 'FontTools/__init__.py' not found (or not a regular file)
 Andrew> package init file 'FontTools/fontTools/__init__.py' not
 Andrew> found (or not a regular file) package init file
 Andrew> 'FontTools/fontTools/encodings/__init__.py' not found (or
 Andrew> not a regular file) error: package directory
 Andrew> 'FontTools/fontTools/misc' does not exist
I won't get a chance to look at your fill code til Monday (which BTW
is something I've been wanting to add for a while), but the main
problem here is that CVS doesn't have a complete version of the
FontTools* and ttf* that are needed to build from src. The 0.51
release is actually quite up to date and you would probably be best
off just working in that tree for now. vis-a-vis FontTools and
ttfquery - an increasing number of matplotlib backends need ttf font
finding capabilitlities which FontTools and ttfquery provide.
However, they are big and a pain to install and Paul Barrett has been
working on a replacement. At one point I added them to CVS since I
was distributing them with matplotlib but thought twice about it and
tried to remove them. However despite multiple attempts I have not
been able to get them out of CVS (a free beer to anyone with commit
privs who can purge these bastards). No in a nutshell there is an
incomplete version of FontTools and ttfquery in CVS.
If you want to build from CVS, copy the agg, FontTools* and ttfquery
dirs/files from the 0.51 src distro into the CVS tree and build from
there. This will all be cleared up in a few weeks time.
JDH
From: Al S. <a.d...@wo...> - 2004年03月05日 17:47:19
I am generating a plot with multi-line ticklabels.
Although the plot displays normally, clicking on the SAVE icon fails
(after selecting the target file name).
I tracked this down as far as afm.get_str_bbox(), line 307 in afm.py
It appears to me that the '\n' character in my multi-line label is
causing the following error:
 File "/usr/local/lib/python2.3/site-packages/matplotlib/afm.py", line
307, in get_str_bbox
 wx, name, bbox = self._metrics[ord(c)]
KeyError: 10
Note that '\n' == 10. I confirmed the failure with a tiny example:
Run the following and click on the SAVE icon, enter a file name, and
observe the failure.
################################
from matplotlib.matlab import *
plot([1,2,3,4], [1,4,9,16])
set(gca(), 'xticks', [1,2,3,4])
t = set(gca(), 'xticklabels', ['Frogs\nOKAY 1', 'Hogs\nFine 2',
'Bogs\nGOOD 3', 'Slogs'])
show()
################################
Although I realize that computing the bounding box of a multi-line text
is a bit more complex, I would really like to see this supported.
Also, I don't know in how many other places the embedded '\n' will cause
problems.
Thanks.
-- 
Al Schapira <a.d...@wo...>
From: John W. <jd...@go...> - 2004年03月05日 17:11:30
I am using the latest CVS release of matplotlib
from sourceforge, and when I try to run the
wx backend example I get
gyrotwystron examples # python embedding_in_wx.py
Could not import mathtext (build with ft2font)
GThread-ERROR **: GThread system may only be initialized once.
aborting...
Aborted
The gtk backend examples work fine (although I still get
the mathtext warning). I have python 2.3 and wxPython 2.4.2.4
on a gentoo linux system.
Thanks!
jgw
From: Al S. <a.d...@wo...> - 2004年03月05日 16:21:56
I found that multi-line ticklabels work fine in normal (hortizontal) 
mode. However, after a set(t, 'rotation', 'vertical') the plot fails 
as shown below. The plot window pops up, then disappears.
System is RH linux 9, matplotlib 0.51, pygtk 2.0.0,
Are multi-line labels supported? In vertical mode too?
Thanks for your help.
	-Al Schapira, a.d...@wo...
### This is based upon the "vertical_ticklabels.py" in /examples.
[ads@ADS1 py]$ cat vertical_ticklabels.py
from matplotlib.matlab import *
plot([1,2,3,4], [1,4,9,16])
set(gca(), 'xticks', [1,2,3,4])
t = set(gca(), 'xticklabels', ['Frogs\nOKAY 1', 'Hogs\nFine 2', 
Bogs\nGOOD 3', 'Slogs'])
set(t, 'rotation', 'vertical') # UNCOMMENT THIS to make the above fail
show()
[ads@ADS1 py]$ python vertical_ticklabels.py
The program 'vertical_ticklabels.py' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
 (Details: serial 1083 error_code 8 request_code 73 minor_code 0)
 (Note to programmers: normally, X errors are reported asynchronously;
 that is, you will receive the error a while after causing it.
 To debug your program, run it with the --sync command line
 option to change this behavior. You can then get a meaningful
 backtrace from your debugger if you break on the gdk_x_error() 
function.)
From: Andrew S. <str...@as...> - 2004年03月05日 12:06:05
G'day all!
I'm back to using matplotlib after a few months away. I'm very 
impressed with the recent progress!
I often plot the instantaneous variance of repeated recordings made 
under the same conditions using a shaded area to surround the mean. I'm 
trying to find a way to do this with matplotlib. Included below is a 
"filly" (fill y) function I wrote to attempt to do this. It doesn't 
quite work yet, and I'd like some help. (BTW, I don't know of how this 
would be done in Matlab, so if there's a more compatible way, I'd be 
happy to change the approach.)
1) How do I make the data fill the axes automatically, such as the 
"plot" function?
2) Is it a bug that the polygon is not filled, or am I missing 
something?
I've only tried this in the PS backend -- I'm having troubles with the 
others at the moment. Also, this is using the version of matplotlib I 
checked out with CVS. This version fails to build the agg backend with:
running build_py
package init file 'ttfquery/__init__.py' not found (or not a regular 
file)
package init file 'FontTools/__init__.py' not found (or not a regular 
file)
package init file 'FontTools/fontTools/__init__.py' not found (or not a 
regular file)
package init file 'FontTools/fontTools/encodings/__init__.py' not found 
(or not a regular file)
error: package directory 'FontTools/fontTools/misc' does not exist
Cheers!
Andrew
-=-=-=-=-=-=-= filly.py -=-=-=-=-=-=-=-=
from matplotlib.matlab import *
from matplotlib.patches import Rectangle, Polygon
def filly(x,y1,y2,**kwargs):
 ax = gca()
 xy = []
 for xi, yi in zip(x,y1):
 xy.append( (xi,yi) )
 for xi, yi in zip(x[::-1],y2[::-1]):
 xy.append( (xi,yi) )
 xy.append( xy[0] )
 polygon = Polygon(
 ax.dpi, ax.bbox,
 xy,
 transx = ax.xaxis.transData, # what does this do?
 transy = ax.yaxis.transData, # and this??
 **kwargs)
 ax.add_patch(polygon)
 return polygon
figure(1)
t = arange(0.0, 1.0, 0.01)
s_mean = 0.5*sin(2*2*pi*t)
s_lo = s_mean-0.1
s_hi = s_mean+0.1
#plot(t,s_mean,'k')
filly(t,s_lo,s_hi,fill=1,facecolor='g')
gca().xaxis.autoscale_view() # why doesn't this help?
gca().yaxis.autoscale_view()
savefig('filly')
#show()
From: matthew a. <ma...@ca...> - 2004年03月05日 06:01:12
On Thu, 4 Mar 2004, matthew arnison wrote:
> * if I savefig('file.eps') from the TkAgg backend, the EPS file is sized 
> to something much bigger than A4 (but it still works fine from the GTK 
> backend)
I've just found I've had similar problems saving EPS figures from the GTK
backend of matplotlib 0.51 too.
Plus TkAgg doesn't like it if you close a plot using the window close box 
(not the X in the toolbar):
[I have TkAgg as my default backend in ~/.matplotlibrc and interactive 
set to True]
$ python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib.matlab import *
>>> x = arange(0.0, 3.14, 0.01)
>>> plot(x, sin(x))
[<matplotlib.lines.Line2D instance at 0x84143b4>]
... click on window close button (not toolbar close button) ...
>>> plot(x, sin(x))
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/lib/python2.2/site-packages/matplotlib/matlab.py", line 788, 
in plot
 draw_if_interactive()
 File 
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_tkagg.py",
line 46, in draw_if_interactive
 figManager.show()
 File 
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_tkagg.py",
line 121, in show
 self.window.deiconify()
 File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1343, in wm_deiconify
 return self.tk.call('wm', 'deiconify', self._w)
TclError: can't invoke "wm" command: application has been destroyed
m.
From: matthew a. <ma...@ca...> - 2004年03月05日 05:07:16
Hi
Now that we have the lovely new syntax for setting legend labels for each 
line:
plot(x, sin(x), label='sin(x)')
plot(x, cos(x), label='cos(x)')
how do we then move the legend from the default upper right location?
legend()
turns the legend on, but the LOC argument has to be second or third, after 
the LINES and/or LABELS. What about a new loc keyword for legend? E.g.
legend(loc=5)
While we're talking about problems inherited from matlab's use of
positional arguments, is there some easy way to set the x or y axis limits
without setting the other axis? E.g. if I want to leave the x axis
automatic, but manually set the y axis?
I looked at help(axis) and at 
http://matplotlib.sourceforge.net/matlab_commands.html
and I couldn't see anything obvious like xaxis or yaxis functions.
This works:
autoaxis = axis()
autoaxis[2:4] = (ymin, ymax)
axis(autoaxis)
but what if I add a plot afterwards that changes the x axis limits?
And it seems like hard work compared to:
yaxis(ymin, ymax)
Cheers,
Matthew.
From: John H. <jdh...@ac...> - 2004年03月04日 21:12:42
>>>>> "Arnold" == Arnold Moene <arn...@wu...> writes:
 Arnold> unsupported operand type(s) for /: 'array' and 'float'
This is a known bug with older versions of Numeric (eg 22.0) combined
with "from __future__ import division". It also affects current
versions of numarray. If you upgrade to the latest Numeric it will go
away. I try and code around it; in this case I forgot. I'll add the
parens.
 Arnold> PS: the mathtext-option was a very pleasant surprise to me
 Arnold> (hadn't seen any discussion on it on the mailing list).
Glad to hear it - there was some discussion on the matplotlib-devel
list. I'm sure you'll encounter strangeness and some parse errors
since it is not widely tested, so please alert me when you do (check
the KNOWN ISSUES section of
http://matplotlib.sourceforge.net/matplotlib.mathtext.html).
JDH
From: Arnold M. <arn...@wu...> - 2004年03月04日 08:31:52
Hi all,
I encountered a strange error (which I now remember was there already in 
version 0.50). When I run (for example) the mathtext_demo.py, I get the 
following error:
<error>
File 
"/usr/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py", 
line 504, in points_to_pixels
 return points*PIXELS_PER_INCH/72.0*self.dpi.get()/72.0
TypeError: unsupported operand type(s) for /: 'array' and 'float'
</error>
When I replace that line 504 with (note the parentheses)
 return points*(PIXELS_PER_INCH/72.0*self.dpi.get()/72.0)
python is happy.
I don't understand why python doesn't like the present construct.
Possibly an odd combination of versions:
-> Python 2.3 (#2, Aug 31 2003, 17:27:29) [GCC 3.3.1 (Mandrake Linux 9.2 
3.3.1-1mdk)] on linux2
-> Numeric 22.0
-> scipy cvs_version = (1,196,1591,4120)
Cheers,
Arnold
PS: the mathtext-option was a very pleasant surprise to me (hadn't seen 
any discussion on it on the mailing list).
From: matthew a. <ma...@ca...> - 2004年03月04日 06:11:37
Well that was one juicy update!
I was just trying to figure out how to speed up the completer in
interactive.py (which adds a noticable lag to the prompt if len(locals()) 
gets to 3000 like it does for me) when I noticed this new release.
TkAgg allows me to use the default python in interactive mode, which 
allows me to use rlcompleter, *and* have matplotlib plots pop up 
without losing the prompt. Which is all lovely.
A couple of issues I noticed with TkAgg:
* fontTools installed one of its files (FontTools.pth I think) without
read permission for normal users, which cause import fontTools to fail
mysteriously
* fontTools didn't find my TTF fonts because the extensions were TTF
instead of ttf
* if I savefig('file.eps') from the TkAgg backend, the EPS file is sized 
to something much bigger than A4 (but it still works fine from the GTK 
backend)
* after playing around, I found that 
text.fontname : sans
in .matplotlibrc is the only way to get reasonably nice sans serif both in 
TkAgg and in eps files. Otherwise I get complaints from one or the other 
(e.g. if I specify Arial or Helvetica).
Cheers and thanks,
Matthew.
From: Sajec, M. T. <ms...@tq...> - 2004年03月04日 03:34:31
First of all, thanks very much for matplotlib! This is a great library, and
fills one of the last voids in regards to scientific python computing.
On to the question, has anyone written a boxplot function yet? If so,
please share the code. If not, I'll take a stab at it.
Best Regards,
Mike
From: Phil E. <pj...@ha...> - 2004年03月04日 00:30:31
Attachments: testBug.jpg
Hello John,
 I have run into the following minor matplotlib bug. Using the sample 
code below, the y axis label and tick marks in the second subplot seem 
not to be in the right places. Also on that second subplot, the first 
legend is missing when the window is initially drawn, but gets redrawn 
correctly if I use the x axis interactive scrolling buttons.
 Attached to this note is a snapshot of the figure window as initially 
drawn showing the bugs. (I don't know whether the mailing list deals 
with attachments correctly, so I'm mailing you a copy directly.)
 The installation here is matplotlib version 0.50 running on a Redhat 
9 linux box:
[pje@amon site-packages]$ uname -a
Linux amon 2.4.20-6smp #1 SMP Thu Feb 27 09:59:40 EST 2003 i686 i686 
i386 GNU/Linux
-----------------------------------------------------------------------
Code:
from matplotlib.matlab import *
figure(1)
subplot(211)
plot(rand(50),'r')
plot(rand(30),'k')
plot(rand(80),'g')
plot(rand(70),'b')
plot(rand(60),'m')
plot(5 * array([1,1]), get(gca(),'ylim'), 'b')
plot(15 * array([1,1]), get(gca(),'ylim'), 'b')
axis([0,100,-2,2])
ylabel('Test me')
title('Test me')
legend(['TX Min', 'RX min', 'Pulse 1', 'Pulse 2', 'P1-P2'])
subplot(212)
plot(rand(50),'r')
plot(rand(30),'k')
plot(rand(80),'g')
plot(rand(70),'b')
plot(rand(60),'m')
plot(5 * array([1,1]), get(gca(),'ylim'), 'b')
plot(15 * array([1,1]), get(gca(),'ylim'), 'b')
axis([0,100,-2,2])
ylabel('Test me')
title('Test me')
legend(['TX Min', 'RX min', 'Pulse 1', 'Pulse 2', 'P1-P2'])
show()
--
----
Phil Erickson email: pj...@ha...
Atmospheric Sciences Group WWW: http://www.haystack.mit.edu
MIT Haystack Observatory voice: 781 981 5769
Westford, MA 01886 USA fax: 781 981 5766
Public key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x54878872
From: John H. <jdh...@ac...> - 2004年03月03日 23:29:54
What's new in matplotlib 0.51
Tkinter backend
 Todd Miller has written a Tkinter backend. This is a significant
 step forward, because now matplotlib works out of the box with any
 python + numeric. The Tkinter backend works interactively from any
 python shell - see the interactive documentation. Also, because
 TkAgg uses the agg backend for rendering, it has all of the features
 of agg, including fast antialiased rendering, freetype2, alpha
 blending, mathtext, and so on. See
 http://matplotlib.sf.net/backends.html#TkAgg. To use the TkAgg
 backend, you must launch your scripts in interactive mode
 > python -i myscript.py -dTkAgg
 otherwise they'll just pop up and disappear.
freetype2 support added for agg backend
 With freetype2, agg now renders fonts nicely even at very small
 raster sizes.
math text
 matplotlib now ships with the BaKoMa TeX Computer Modern fonts, and
 displays math text using TeX expressions. See screenshot
 http://matplotlib.sf.net/screenshots.html#mathtext_demo and the
 mathtext documentation
 http://matplotlib.sf.net/matplotlib.mathtext.html for usage
 information. Currently available on GTK, Agg, TkAgg and GTKAgg. If
 you build matplotlib yourself, you need to edit setup.py and set
 BUILD_FT2FONT
configuration file
 A configuration file is placed in your install path
 (distutils.sysconfig.PREFIX + 'share/matplotlib'). This determines
 many of the default figure properties: the default backend, line
 properties, text properties, colors, and more. See
 http://matplotlib.sf.net/.matplotlibrc for an example configuration
 file and details. Place this in your home dir (linux and friends),
 or edit in the install path (windows).
numarray support
 Todd Miller has provided a numerix module
 http://matplotlib.sf.net/matplotlib.numerix.html which allows you to
 choose between Numeric of numarray. You can set Numeric or numarray
 in your matplotlibrc file, with an environment variable, or from the
 prompt. See the numerix module for more information and numarray
 issues http://matplotlib.sf.net/NUMARRAY_ISSUES for a summary of
 known issues in using numarray.
data clipping off by default
 Data clipping, as opposed to viewport clipping, is turned off by
 default. You can change the default behavior in .matplotlibrc or set
 it to be true when needed as in examples/stock_demo.py
kwargs in plot commands
 The plot commands now take kwargs that are can be used to set line
 properties (any property that has a set_* method). You can use this
 to set a line label (for auto legends), linewidth, anitialising,
 marker face color, etc. Here is an example:
 plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
 plot([1,2,3], [1,4,9], 'rs', label='line 2')
 axis([0, 4, 0, 10])
 legend()
Bugfixes and minor improvements
 * GTK : fixed a subplot selection GUI bug specific to python2.2
 * GTK : fixed a text layout bug 
 * ALL : Fixed a multiple column subplot layout bug
 * PS : Fixed an afm parser - thanks Dominique
 * Agg : Agg now respects antialiased=False
Download: 
 http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474&release_id=221304
From: John H. <jdh...@ac...> - 2004年03月03日 17:57:45
>>>>> "Phil" == Phil Erickson <pj...@ha...> writes:
 Phil> Hello John, I have run into the following minor matplotlib
 Phil> bug. Using the sample code below, the y axis label and tick
 Phil> marks in the second subplot seem not to be in the right
 Phil> places. Also on that second subplot, the first legend is
 Phil> missing when the window is initially drawn, but gets redrawn
 Phil> correctly if I use the x axis interactive scrolling buttons.
Hi Phil,
Wow, that was a subtle one. Thanks very much for a detailed
description, screenshot and demo code. You can distill the essence of
the bug in this script
 from matplotlib.matlab import *
 subplot(211)
 plot([1,2,3])
 ylabel('Test me')
 subplot(212)
 plot([1,2,3])
 ylabel('Test me')
 show()
The key observation is that this script exposes the bug, but
examples/subplot_demo.py does not. I found that if I commented out
the first ylabel the bug also disappeared. This led me to the
solution.
I cache font instances in many of the backends since font creation and
drawing can be expensive, particularly on the GTK backend for vertical
text where I have to do the rotation by hand, pixel-by-pixel in
python. In the cache I map text properties to font instances in a
dictionary. As one of the properties, I was using the x, and y coords
of the text in *user* rather than *display* coords, so the second
ylabel was using the cached information of the first. In the case of
the ylabels, the user coords are relative to their respective axes,
and so are identical for identical labels.
The same explanation applies to the legend code because the legends
had duplicate text.
A simple fix. In matplotlib.text.py, on or around line 118 replace
get_prop_tup with
 def get_prop_tup(self):
 """
 Return a hashable tuple of properties
 Not intended to be human readable, but useful for backends who
 want to cache derived information about text (eg layouts) and
 need to know if the text has changed
 """
 x, y = self.get_xy_display()
 return (x, y, self._text, self._color,
 self._verticalalignment, self._horizontalalignment,
 self._fontname, self._fontsize, self._fontweight,
 self._fontangle, self._rotation, self.dpi.get())
The key is to use the display coords for the cache value.
Thanks again,
JDH
From: Phil E. <pj...@ha...> - 2004年03月03日 16:11:46
John Hunter wrote:
>>>>>>"Phil" == Phil Erickson <pj...@ha...> writes:
> 
> 
> Phil> Hi all, I am really enjoying working with matplotlib and
> Phil> hats off to an excellent effort.
> 
> Phil> I have done a cursory search of the mailing list archives
> Phil> but didn't find the answer to a practical question that I
> Phil> ran into in MATLAB all the time (which is where I'm coming
> Phil> from in terms of familiarity).
> 
> Phil> Suppose I have an array to plot, and I want to exclude
> Phil> certain points from being plotted. In MATLAB, I would set
> Phil> the y vector points I wanted excluded to "NaN" and then the
> Phil> plot routine would draw connected lines up to the point
> Phil> before the excluded one, skip the bad/not wanted point, and
> Phil> then continue drawing lines beginning at the next point.
> 
> Phil> How does one accomplish that using matplotlib? This
> Phil> actually comes up quite often in our radar work here, in
> Phil> cases where we are making log plots of vectors which may
> Phil> contain zeros.
> 
> What matplotlib currently does is simply ignore non-positive data with
> an approach along the lines of
> 
> ind = nonzero(y > 0)
> validy = take(y, ind)
> 
> Just to make sure I'm understanding you properly, that's not a good
> solution for you because you want to the gap in the connected line
> where the complex (y<=0) points are. Is this right?
That's right. In our field, we often have data sets which have to be 
culled before plotting for points which might fail some sanity test like 
excessive variance, etc. I'm sure other science data sets have a 
similar requirement. For ease of use, I would definitely not want to 
have to break up my plot task into multiple lines myself by segmenting 
the incoming data, but rather have the method do it based on some signal 
value in the data.
In fact, the plots that I was trying to make were of a quantity which 
needs to be expressed in dB, which is
10 * log10(y)
So the problem is actually a bit more general, in that just calling 
semilogy() would make a plot of log10(y) which is not quite the same. 
For my needs, I have been using
plot(x, 10 * ProtectedLog(y))
where:
def ProtectedLog(a):
 "Calculate log10() but protect against non-positives."
 zeroIndex = find(a <= 0.0)
 b = array(a)
 for index in zeroIndex:
	# ideally we would use whatever value will
	# signal a non-plotted point; 1e-30 is
	# non-optimal
 b[index] = 1e-30
 c = log10(b)
 return c
Therefore, both plot() and semilogy() would have to pay attention to a 
special signal value.
> 
> What you describe is certainly possible but would impose a performance
> hit that depends on the number of separate connected lines that had to
> be constructed. Eg, semilogy could find the non-positive indices and
> create the line segments appropriately.
Indeed, but your line drawing functions seem to be fast enough that 
maybe this isn't an issue.
> 
> As for NaN, I'm not an expert here. As far as I understand, there is
> no support for it in Numeric but there is in numarray. Look for basic
> numarray support in the next release.
All our code uses Numeric, so we have inertia working against us :) NaN 
is for me just a value that I know MATLAB pays attention to when 
plotting. If you had another way to put a value in, I could use that 
and all would be well.
Unfortunately, it seems Python has some trouble with IEEE standard 
values such as positive/negative infinity and NaNs. There seems to be a 
pure Python package which would handle IEEE 754 standard NaN values at
http://www.analytics.washington.edu/Zope/projects/fpconst/
which perhaps might be a way to go. The author has also made a request 
that this functionality be included in further Python releases.
cheers,
-- 
----
Phil Erickson email: pj...@ha...
Atmospheric Sciences Group WWW: http://www.haystack.mit.edu
MIT Haystack Observatory voice: 781 981 5769
Westford, MA 01886 USA fax: 781 981 5766
Public key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x54878872
From: John H. <jdh...@ac...> - 2004年03月03日 15:43:25
>>>>> "Phil" == Phil Erickson <pj...@ha...> writes:
 Phil> Hi all, I am really enjoying working with matplotlib and
 Phil> hats off to an excellent effort.
 Phil> I have done a cursory search of the mailing list archives
 Phil> but didn't find the answer to a practical question that I
 Phil> ran into in MATLAB all the time (which is where I'm coming
 Phil> from in terms of familiarity).
 Phil> Suppose I have an array to plot, and I want to exclude
 Phil> certain points from being plotted. In MATLAB, I would set
 Phil> the y vector points I wanted excluded to "NaN" and then the
 Phil> plot routine would draw connected lines up to the point
 Phil> before the excluded one, skip the bad/not wanted point, and
 Phil> then continue drawing lines beginning at the next point.
 Phil> How does one accomplish that using matplotlib? This
 Phil> actually comes up quite often in our radar work here, in
 Phil> cases where we are making log plots of vectors which may
 Phil> contain zeros.
What matplotlib currently does is simply ignore non-positive data with
an approach along the lines of
 ind = nonzero(y > 0)
 validy = take(y, ind)
Just to make sure I'm understanding you properly, that's not a good
solution for you because you want to the gap in the connected line
where the complex (y<=0) points are. Is this right?
What you describe is certainly possible but would impose a performance
hit that depends on the number of separate connected lines that had to
be constructed. Eg, semilogy could find the non-positive indices and
create the line segments appropriately.
As for NaN, I'm not an expert here. As far as I understand, there is
no support for it in Numeric but there is in numarray. Look for basic
numarray support in the next release.
JDH
From: John H. <jdh...@ac...> - 2004年03月03日 15:27:22
>>>>> "Kuzminski," == Kuzminski, Stefan R <SKu...@fa...> writes:
 Kuzminski> I tried the new Agg backend, very nice. I'm all set
 Kuzminski> to jettison GD altogether and go with Agg except that
 Kuzminski> the anti-aliased graphs that look so great, print
 Kuzminski> poorly.. :-( Is there a way to turn off the
 Kuzminski> anti-aliasing? It would be *great* to be able to drop
 Kuzminski> that GD dependency.
agg plus/minus antialiasing is included in the next release, due out
soon. Alpha version is here if you want to test. Please report any
problems.
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.51g.win32-py2.3.exe
JDH
5 messages has been excluded from this view by a project administrator.

Showing results of 148

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