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



Showing results of 432

<< < 1 .. 9 10 11 12 13 .. 18 > >> (Page 11 of 18)
From: George N. <gn...@go...> - 2008年12月12日 12:50:31
It's very nice to have a native macosx backend. Many thanks to Michiel.
It does seem to work with ipython fine.
However, at present, it's not always faster than WXAgg.
With matplotlib svn r6575, python 2.5.2, everything compiled with
gcc4.0, 10.5.5, macbook pro 2.33GHz, 2GB memory
(i) interactive zooming of the plot window seems very slow
(ii) in scripts, pcolormesh and pcolor seem much slower than WXAgg,
though ax.pcolorfast is faster..
on a 1000x200 array:
pcolormesh:
[242-132:~/Python] agn% time python testspeed.py -dmacosx
32.717u 1.479s 0:43.76 78.1%	0+0k 0+23io 0pf+0w
242-132:~/Python] agn% time python testspeed.py -dWXAgg
1.226u 0.444s 0:05.80 28.6%	0+0k 0+25io 0pf+0w
pcolor:
[242-132:~/Python] agn% time python testspeed3.py -dmacosx
53.652u 2.099s 2:09.58 43.0%	0+0k 0+154io 0pf+0w
[242-132:~/Python] agn% time python testspeed3.py -dWXAgg
26.775u 1.542s 0:32.25 87.7%	0+0k 0+35io 0pf+0w
ax.pcolorfast:
[242-132:~/Python] agn% time python testspeed2.py -dmacosx
0.580u 0.331s 0:04.07 22.3%	0+0k 0+2io 0pf+0w
[242-132:~/Python] agn% time python testspeed2.py -dWXAgg
0.988u 0.423s 0:04.70 29.7%	0+0k 0+11io 0pf+0w
(iii) explicit creation of figure and axes instances seems to slow it
down radically in ipython:
e.g
In [3]: a= numpy.random.rand(100,200)
.. a few creations of plots and theitr removal, to get started..
With WxAgg backend:
In [8]: time pcolormesh(a)
CPU times: user 0.22 s, sys: 0.03 s, total: 0.25 s
Wall time: 0.25 s
Out[9]: <matplotlib.collections.QuadMesh object at 0x19661330>
With macosx backend:
In [39]: time pcolormesh(a)
CPU times: user 0.05 s, sys: 0.01 s, total: 0.06 s
Wall time: 0.08 s
so, 3x as fast.
However, explicitly creating the figure is much slower on macosx:
In [26]: time fig=figure();ax=fig.add_subplot(1,1,1);ax.pcolormesh(a);draw()
CPU times: user 3.33 s, sys: 0.03 s, total: 3.36 s
Wall time: 3.41 s
In [37]: time fig=figure();ax=fig.add_subplot(1,1,1);pcolormesh(a);draw()
CPU times: user 3.39 s, sys: 0.03 s, total: 3.42 s
Wall time: 3.46 s
while with wxagg there is little change in speed:
In [16]: time fig=figure();ax=fig.add_subplot(1,1,1);ax.pcolormesh(a);draw()
CPU times: user 0.21 s, sys: 0.03 s, total: 0.25 s
Wall time: 0.25 s
--George Nurser.
From: Jeff W. <js...@fa...> - 2008年12月12日 12:49:07
Mauro Cavalcanti wrote:
> Dear Jeff & ALL,
>
> Attached is the latest version of my Basemap embedded in wxPython
> sample application. I have added a check menu option that allows one
> to toggle the overlay of the Blue Marble image on and off the Basemap
> figure. Everything works well -- except that the Blue Marble image is
> plotted upside down! I could not figure out the cause of this, say,
> rather bizarre behaviour. Any hints?
>
> Thanks in advance for any assistance you can provide.
>
> Best regards,
>
> PS This version has another known bug, to be eventually fixed -- if
> the user has plotted a point coordinate file, the points are erased if
> the Blue Marble overlay is requested because the PlotMap() routine
> calls ax.cla() at the start.
>
> 
Mauro: The image flipping looks to be a Wx backend bug - it doesn't happen if you use WxAgg instead.
-Jeff
P.S. It's not recommended to use tabs in python code. Especially don't mix tabs and spaces (http://www.python.org/dev/peps/pep-0008/).
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Eric B. <eri...@gm...> - 2008年12月12日 05:27:13
+1 for including Brian's changes in the shipping example.
Brian, You might also be interested in an alternate, polygon-based
lasso I developed a while back. Though it meets my needs, beware of
backend-specific problems with idle events that I never resolved.
-Eric
http://www.nabble.com/Alternate-lasso:-click-to-form-polygon-td18724261.html
On Sun, Dec 7, 2008 at 10:24 AM, B Clowers <clo...@ya...> wrote:
> When running the initial lasso demo I found that only one lasso event was
> allowed and other canvas interaction events (e.g. zooming) would not work
> properly after the lasso event. As such I came up with my own solution to
> the problem by modifying the example source. The primary addition was a
> button release event call and a boolean to keep track whether the lasso was
> the last event to lock the widget from interaction. Anyway, I hope it can
> help someone else out.
>
> Cheers,
>
> Brian
>
> ####################################
> """
> Show how to use a lasso to select a set of points and get the indices
> of the selected points. A callback is used to change the color of the
> selected points
>
> This is currently a proof-of-concept implementation (though it is
> usable as is). There will be some refinement of the API and the
> inside polygon detection routine.
> """
> from matplotlib.widgets import Lasso
> import matplotlib.mlab
> from matplotlib.nxutils import points_inside_poly
> from matplotlib.colors import colorConverter
> from matplotlib.collections import RegularPolyCollection
>
> from matplotlib.pyplot import figure, show
> from numpy import nonzero
> from numpy.random import rand
>
> class Datum:
> colorin = colorConverter.to_rgba('red')
> colorout = colorConverter.to_rgba('green')
> def __init__(self, x, y, include=False):
> self.x = x
> self.y = y
> if include: self.color = self.colorin
> else: self.color = self.colorout
>
>
> class LassoManager:
> def __init__(self, ax, data):
> self.axes = ax
> self.canvas = ax.figure.canvas
> self.data = data
> #the lasso lock boolean is used to tell whether another
> #widget event has priority
> self.lassoLock = False
>
> self.Nxy = len(data)
>
> facecolors = [d.color for d in data]
> self.xys = [(d.x, d.y) for d in data]
> fig = ax.figure
> self.collection = RegularPolyCollection(
> fig.dpi, 6, sizes=(100,),
> facecolors=facecolors,
> offsets = self.xys,
> transOffset = ax.transData)
>
> ax.add_collection(self.collection)
>
> self.cid = self.canvas.mpl_connect('button_press_event',
> self.onpress)
> self.cidRelease = self.canvas.mpl_connect('button_release_event',
> self.onrelease)
>
> self.ind = None
>
> def callback(self, verts):
> facecolors = self.collection.get_facecolors()
> ind = nonzero(points_inside_poly(self.xys, verts))[0]
> for i in range(self.Nxy):
> if i in ind:
> facecolors[i] = Datum.colorin
> else:
> facecolors[i] = Datum.colorout
>
> self.canvas.draw_idle()
> self.canvas.widgetlock.release(self.lasso)
> #del self.lasso
> self.ind = ind
>
> def onpress(self, event):
> if self.canvas.widgetlock.locked(): return
> if event.inaxes is None: return
> self.lasso = Lasso(event.inaxes, (event.xdata, event.ydata),
> self.callback)
> # acquire a lock on the widget drawing
> self.canvas.widgetlock(self.lasso)
> # establish boolean that can be used to release the widgetlock
> self.lassoLock = True
>
> def onrelease(self, event):
> 'on release we reset the press data'
> # test whether the widgetlock was initiated by the lasso
> if self.lassoLock:
> self.canvas.widgetlock.release(self.lasso)
> self.lassoLock = False
> print self.ind
>
>
> if __name__ == '__main__':
>
> data = [Datum(*xy) for xy in rand(100, 2)]
>
> fig = figure()
> ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
> lman = LassoManager(ax, data)
>
> show()
>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you. Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: mtcoder <jbe...@gm...> - 2008年12月12日 05:16:25
Good Day! 
In the course of testing two ode solvers (stiff and non-stiff) I noticed
that the figures that were saved (either eps or pdf) were fuzzy. The figures
produced by the command pylab.plot(xdata, ydata) followed by pylab.show()
were essentially smooth. When I zoomed in all lines were straight and I
could distinguish where the ode solver was making steps. But the saved
figures are completely different. Sure, the curve follows the same
trajectory as the original plot it was produced from, but they line itself
is fuzzy. I've attached a sample: 
http://www.nabble.com/file/p20970084/testode.rk45.a0.99.eps1e-07.pdf
testode.rk45.a0.99.eps1e-07.pdf . This comes from a completely deterministic
ode. But is looks like I've added a tiny amount of noise.
On a technical note, I'm running Ubuntu 8.04, python2.5.1, matplotlib0.91.2
(with GTKAgg backend). 
(Hopefully I didn't miss a similar question--and solution--elsewhere in the
forum.)
Thanks for your help,
-Jesse
-- 
View this message in context: http://www.nabble.com/Fuzzy-plots-of-ode-solutions-tp20970084p20970084.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jörgen S. <jor...@bo...> - 2008年12月11日 22:26:50
Jouni K. Seppänen skrev:
> 
> In Unix shells ' is the better quoting character because all sorts of
> things have special meaning within " characters... but I changed it to
> use subprocess.Popen instead, so we shouldn't need to worry about shell
> quoting at all.
> 
> Jörgen: Thanks for your report, which I think is the first one from a
> Windows user using usetex with the pdf backend. Can you check that the
> latest version on the trunk works (either by updating from svn or by
> applying the attached patch)? Have you run into any other problems? What
> TeX distribution are you using?
> 
>
Jouni,
I'll try it out tomorrow.
/Jörgen
From: Jouni K. S. <jk...@ik...> - 2008年12月11日 20:42:42
Michael Droettboom <md...@st...> writes:
> Jörgen Stenarson wrote:
>> I tried to use usetex to generate my pdf figures but I got a crash 
>> when saving the figure, log attached. I traced the crash to 
>> find_tex_file(), apparently ' can not be used to quote filenames in 
>> the windows shell it has to be ". In my patch I just changed it to 
>> always use " I don't know if that works on other systems.
> Someone who knows about usetex should review and apply this patch.
In Unix shells ' is the better quoting character because all sorts of
things have special meaning within " characters... but I changed it to
use subprocess.Popen instead, so we shouldn't need to worry about shell
quoting at all.
Jörgen: Thanks for your report, which I think is the first one from a
Windows user using usetex with the pdf backend. Can you check that the
latest version on the trunk works (either by updating from svn or by
applying the attached patch)? Have you run into any other problems? What
TeX distribution are you using?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Mauro C. <mau...@gm...> - 2008年12月11日 19:49:41
Attachments: Gaia.py
Dear Jeff & ALL,
Attached is the latest version of my Basemap embedded in wxPython
sample application. I have added a check menu option that allows one
to toggle the overlay of the Blue Marble image on and off the Basemap
figure. Everything works well -- except that the Blue Marble image is
plotted upside down! I could not figure out the cause of this, say,
rather bizarre behaviour. Any hints?
Thanks in advance for any assistance you can provide.
Best regards,
PS This version has another known bug, to be eventually fixed -- if
the user has plotted a point coordinate file, the points are erased if
the Blue Marble overlay is requested because the PlotMap() routine
calls ax.cla() at the start.
-- 
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: Michael D. <md...@st...> - 2008年12月11日 18:28:08
Jörgen Stenarson wrote:
> Michael Droettboom skrev:
>>> put the pfm/pfb files it somewhere else and have matplotlib use it?
>> I believe Nimbus Roman is just a clone of Times that is included with 
>> Ghostscript.
>>
>> http://www.tug.dk/FontCatalogue/nimbus/
>>
>> If you have Times or Times New Roman installed, that's probably a 
>> reasonable substitute.
>>
>
> I tried to use usetex to generate my pdf figures but I got a crash 
> when saving the figure, log attached. I traced the crash to 
> find_tex_file(), apparently ' can not be used to quote filenames in 
> the windows shell it has to be ". In my patch I just changed it to 
> always use " I don't know if that works on other systems.
Someone who knows about usetex should review and apply this patch.
But just for clarification -- the font lookup issues we were talking 
about yesterday only apply when usetex is False. When usetex is True, 
all the font lookup happens with LaTeX, so you can't directly specify a 
font by name. Any particular reason why you're using usetex over the 
default?
Cheers,
Mike
From: Jörgen S. <jor...@bo...> - 2008年12月11日 17:47:13
Michael Droettboom skrev:
>> put the pfm/pfb files it somewhere else and have matplotlib use it?
> I believe Nimbus Roman is just a clone of Times that is included with 
> Ghostscript.
> 
> http://www.tug.dk/FontCatalogue/nimbus/
> 
> If you have Times or Times New Roman installed, that's probably a 
> reasonable substitute.
> 
I tried to use usetex to generate my pdf figures but I got a crash when 
saving the figure, log attached. I traced the crash to find_tex_file(), 
apparently ' can not be used to quote filenames in the windows shell it 
has to be ". In my patch I just changed it to always use " I don't know 
if that works on other systems.
/Jörgen
On Thu, Dec 11, 2008 at 10:19 AM, TP <par...@fr...> wrote:
> Hi,
>
> I use matplotlib 0.91.2.
> When I plot the same Line2D on two subplots, it disappears: execute the
> following script:
>
> #######################
> from pylab import *
> ion()
> f = figure()
> s = f.add_subplot("211")
> curve = matplotlib.lines.Line2D([0,1],[0,1],color='m')
> s.add_line( curve )
> s2 = f.add_subplot("212")
> draw()
> raw_input('press a key to delete a line to second subplot')
> s2.add_line( curve )
> s2.lines[-1].figure.canvas.draw()
> print s2.lines[-1].get_visible()
> raw_input('press a key to quit')
> #######################
>
> What is the reason for this behavior?
The lines get their transforms from the axes they reside in -- you
can't share a line on multiple axes
From: John H. <jd...@gm...> - 2008年12月11日 17:31:21
On Thu, Dec 11, 2008 at 7:56 AM, TP <par...@fr...> wrote:
> TP wrote:
>
>> I have a question about the behavior of "del()" Python built-in.
>
> Ok, del only removes a name from the local namespace.
> I have found an old answer of John, below. It seems that a better solution
> is to use the remove method of a line instance:
>
> http://osdir.com/ml/python.matplotlib.general/2005-05/msg00045.html
>
> Until now, I used "del" which works well when the complete object hierarchy
> is given...
The line is stored in axes.lines list, so simply deleting it will not
work because there is a reference to it in the list. You need to
remove it from the list, as you inidicate. See also
http://matplotlib.sourceforge.net/users/artists.html
Hi,
I use matplotlib 0.91.2.
When I plot the same Line2D on two subplots, it disappears: execute the
following script:
#######################
from pylab import *
ion()
f = figure()
s = f.add_subplot("211")
curve = matplotlib.lines.Line2D([0,1],[0,1],color='m')
s.add_line( curve )
s2 = f.add_subplot("212")
draw()
raw_input('press a key to delete a line to second subplot')
s2.add_line( curve )
s2.lines[-1].figure.canvas.draw()
print s2.lines[-1].get_visible()
raw_input('press a key to quit')
#######################
What is the reason for this behavior?
Thanks
Julien
PS: thanks to Friedrich Hagedorn for his correction of my signature.
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1\
+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: TP <par...@fr...> - 2008年12月11日 13:56:51
TP wrote:
> I have a question about the behavior of "del()" Python built-in.
Ok, del only removes a name from the local namespace.
I have found an old answer of John, below. It seems that a better solution
is to use the remove method of a line instance:
http://osdir.com/ml/python.matplotlib.general/2005-05/msg00045.html
Until now, I used "del" which works well when the complete object hierarchy
is given...
Thanks
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1+,\'Z
(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: TP <par...@fr...> - 2008年12月11日 13:16:04
Hi everybody,
I have a question about the behavior of "del()" Python built-in.
In the following example, when I use del() on the copy of a line, it does
not delete it, whereas with the original line, it works. Why? I do not
understand, because the id is the same for the copy and the original:
#######################
from pylab import *
import Tkinter as Tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
ion()
root = Tk.Tk()
f = Figure( figsize = (8,7) )
veryplot = FigureCanvasTkAgg( f
 , master = root )
veryplot.get_tk_widget().pack( side = Tk.LEFT
 , expand = Tk.YES
 , fill = Tk.BOTH )
b = f.add_subplot( 211 )
t = arange(0.01, 5.0, 0.01)
s1 = sin(2*pi*t)
b.plot( t, s1 )
b.plot( t, s1+1 )
print b.lines
raw_input('press a key to delete a line with a copy')
line_copy = b.lines[-1]
print "original id=", id( b.lines[-1] ), "copy id", id( line_copy )
del( line_copy ) # or b.lines.pop()
b.figure.canvas.draw()
print b.lines
raw_input('press a key to delete a line directly')
print "original id=", id( b.lines[-1] )
del( b.lines[-1] ) # or b.lines.pop()
b.figure.canvas.draw()
print b.lines
raw_input('press a key to quit')
#######################
Thanks in advance,
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1+,\'Z
(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: Manuel M. <mm...@as...> - 2008年12月11日 08:00:42
Zane Selvans wrote:
> It seems like there ought to be an easy way to associate labels with the 
> various groups of patches generated by a call to hist() that uses a list 
> of arrays, setting label=["a", "list", "of", "strings"] for instance, 
> instead of having to go in and label one patch from each returned list 
> of patches afterward. Would make legend creation easier anyway.
Good point! Has to be added. Thanks.
mm
> Just a suggestion,
> Zane
> 
> -- 
> Zane Selvans
> Amateur Earthling
> za...@id...
> 303/815-6866
> http://zaneselvans.org
> PGP Key: 55E0815F
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
From: Scott S. <sco...@gm...> - 2008年12月11日 06:11:38
Hi,
I noticed that there is a problem rendering the plot here:
http://matplotlib.sourceforge.net/users/screenshots.html#basemap-demo
It might be something to do with the location of the data required by
the plotmap.py demo script (line 14).
Cheers,
Scott
From: John H. <jd...@gm...> - 2008年12月11日 02:41:46
On Wed, Dec 10, 2008 at 5:20 PM, pierre garrigues <
pie...@gm...> wrote:
>
> # create the initial line
> x = np.linspace(-3, 3, 1000)
> line, = plt.plot(x, np.sin(x), animated=True)
>
> # save the clean slate background -- everything but the animated line
> # is drawn and saved in the pixel buffer background
> background = canvas.copy_from_bbox(ax.bbox)
>
It looks to me that you need to force a figure draw *before* doing
copy_from_bbox. Eg::
 fig.canvas.draw()
 background = canvas.copy_from_bbox(ax.bbox)
The reason you are seeing a difference between ipython "run" and ipython
copy-and-paste is that in "run" mode ipython turns interactive drawing off
(for details see http://matplotlib.sourceforge.net/users/shell.html) so the
draw event is never called, and the cached renderer, which is triggering
your exception, is never set.
This is speculation, as I haven't tested, so please answer back if this
fixes your problem and if so I will update the matplotlib animation recipe
which also suffers from this problem (which is not exposed unless you are
running in interactive mode, which you are). It is on my list of things to
do to write a proper animation chapter for the user's guide....
JDH
From: John H. <jd...@gm...> - 2008年12月11日 01:17:35
On Wed, Dec 10, 2008 at 5:01 PM, Ryan Wagner <rw...@vn...> wrote:
> Just upgraded to 98.4. Can reproduce this on two XP32 boxes. Any
> thoughts?
>
This is a bug in the win32 installer, which has gtkagg set as the default
backend. You can fix this by setting TkAgg in the backend, which is what we
*should* have done in the installer. You need to change the line
 backend : GTKAgg
to
 backend : TkAgg
in your matplotlibrc config file. Instructions for editing the rc file can
be found at http://matplotlib.sourceforge.net/users/customizing.html. You
can also read about "what is a backend?" here -
http://matplotlib.sourceforge.net/faq/installing_faq.html#id1
We will be putting out new installers that fix this problem ASAP, so those
of you who on windows who have not yet installed 98.4 may prefer to wait
until we announce the fixed installers are up. This problem does not affect
the src tarball or the os x installers.
Sorry for the trouble!
JDH
From: Michael D. <md...@st...> - 2008年12月10日 23:20:39
Jörgen Stenarson wrote:
> Michael Droettboom skrev:
>> Unfortunately, I think this is a bug. The ordering of fonts in the 
>> family list is being ignored, and Bitstream Vera Sans is winning over 
>> Nimbus Roman for reasons other than its name. I'll have to get this 
>> patch in for the bugfix release we're already planning.
>>
>> As a workaround, try putting only "Nimbus Roman No9 L" as the only 
>> font in the list. Does that help?
>>
>> Also, I don't see the Nimbus Roman font file (n021003l.ttf) anywhere 
>> in the debugging output. Are you sure it's in C:\Windows\Fonts ?
>>
>> Mike
>>
>
> As you say it seems only one font at a time can be specified. These 
> are the ones I have managed to use by only specifying a single font: 
> Times New Roman, Georgia, Euclid, Arial, Vera.
>
> It seems the Nimbus Roman my LaTeX installation uses is from 
> utmr8a.pfm and utmr8a.pfb some kind of Type 1 font. I can install the 
> pfm file in the system font directory but not the pfb files, anyway 
> matplotlib won't use it. 
That is correct. matplotlib can only use ttf files (or the standard 14 
Postscript files when outputting Postscript).
> Is there a free ttf version available somewhere or is it possible to 
> put the pfm/pfb files it somewhere else and have matplotlib use it?
I believe Nimbus Roman is just a clone of Times that is included with 
Ghostscript.
http://www.tug.dk/FontCatalogue/nimbus/
If you have Times or Times New Roman installed, that's probably a 
reasonable substitute.
Cheers,
Mike
From: pierre g. <pie...@gm...> - 2008年12月10日 23:20:07
Hi,
I have taken the blit example and modified it such that it runs on my mac.
The function is called blit_ex.py. It works well when I paste the code in
ipython, but it doesn't when I do "run blit_ex.py" from ipython.
I am using EPD Py25 4.1.30001_beta1 and Mac OS 10.5.
The error message is:
In [1]: run blit_ex.py
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
/Users/pierre/Desktop/blit_ex.py in <module>()
 24 canvas.restore_region(background)
 25 line.set_ydata(np.sin(x+i/10.))
---> 26 ax.draw_artist(line)
 27 canvas.blit(ax.bbox)
 28
/Library/Frameworks/Python.framework/Versions/4.1.30001/lib/python2.5/site-packages/matplotlib-0.98.3.0001-py2.5-macosx-10.3-fat.egg/matplotlib/axes.pyc
in draw_artist(self, a)
 1532 data (axis ticks, labels, etc are not updated)
 1533 """
-> 1534 assert self._cachedRenderer is not None
 1535 a.draw(self._cachedRenderer)
 1536
AssertionError:
WARNING: Failure executing file: <blit_ex.py>
And the code is
import matplotlib.pyplot as plt
import numpy as np
import time
plt.figure(1)
plt.clf()
ax = plt.subplot(111)
canvas = ax.figure.canvas
# for profiling
tstart = time.time()
# create the initial line
x = np.linspace(-3, 3, 1000)
line, = plt.plot(x, np.sin(x), animated=True)
# save the clean slate background -- everything but the animated line
# is drawn and saved in the pixel buffer background
background = canvas.copy_from_bbox(ax.bbox)
for i in range(100):
 canvas.restore_region(background)
 line.set_ydata(np.sin(x+i/10.))
 ax.draw_artist(line)
 canvas.blit(ax.bbox)
Thanks!
Pierre
From: Ryan W. <rw...@vn...> - 2008年12月10日 23:01:51
Just upgraded to 98.4. Can reproduce this on two XP32 boxes. Any thoughts?
C:\Documents and Settings\rwagner\Desktop>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylab import *
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "C:\Python25\Lib\site-packages\pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 253, in <module
>
 from matplotlib.pyplot import *
 File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 75, in <module
>
 new_figure_manager, draw_if_interactive, show = pylab_setup()
 File "C:\Python25\Lib\site-packages\matplotlib\backends\__init__.py", line 25,
 in pylab_setup
 globals(),locals(),[backend_name])
 File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", li
ne 10, in <module>
 from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCan
vasGTK,\
 File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtk.py", line
11, in <module>
 raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.
>>>
From: Eric F. <ef...@ha...> - 2008年12月10日 22:58:58
Sara Hatch wrote:
> I ran into a little problem when adding an axis span (both vertical and 
> horizontal) to my plot. When I use the optional keyword arguments, I get 
> an error message:
> 
> import pylab
> pylab.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/lib/python2.5/site-packages/matplotlib/pyplot.py", line 1572, 
> in axhspan
> ret = gca().axhspan(*args, **kwargs)
> File "/lib/python2.5/site-packages/matplotlib/axes.py", line 2883, in 
> axhspan
> self._process_unit_info( [xmin, xmax], [ymin, ymax], **kwargs )
> TypeError: _process_unit_info() got an unexpected keyword argument 'alpha'
> 
> Granted, I can get the results I want using the .set_xxx() methods, but 
> my first method should have worked, right?
> 
> I've never filed a bug for matplotlib before, so I figured I'd send out 
> an email to the users-group first. 
Sara,
Thank you, that is indeed the right thing to do. In addition, please 
state what matplotlib version you are using. Often, although not in 
this case, it is also critical to know what operating system you are 
using, and the numpy version.
You have definitely hit a bug, but it has been fixed--I don't see it in 
svn. I don't know how long ago it was fixed. A new release of mpl has 
just come out. Can you upgrade?
Eric
> 
> Thanks,
> Sara
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you. Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jörgen S. <jor...@bo...> - 2008年12月10日 22:54:31
Michael Droettboom skrev:
> Unfortunately, I think this is a bug. The ordering of fonts in the 
> family list is being ignored, and Bitstream Vera Sans is winning over 
> Nimbus Roman for reasons other than its name. I'll have to get this 
> patch in for the bugfix release we're already planning.
> 
> As a workaround, try putting only "Nimbus Roman No9 L" as the only font 
> in the list. Does that help?
> 
> Also, I don't see the Nimbus Roman font file (n021003l.ttf) anywhere in 
> the debugging output. Are you sure it's in C:\Windows\Fonts ?
> 
> Mike
> 
As you say it seems only one font at a time can be specified. These are 
the ones I have managed to use by only specifying a single font: Times 
New Roman, Georgia, Euclid, Arial, Vera.
It seems the Nimbus Roman my LaTeX installation uses is from utmr8a.pfm 
and utmr8a.pfb some kind of Type 1 font. I can install the pfm file in 
the system font directory but not the pfb files, anyway matplotlib won't 
use it. Is there a free ttf version available somewhere or is it 
possible to put the pfm/pfb files it somewhere else and have matplotlib 
use it?
Thanks for looking in to this,
Jörgen
From: Zane S. <za...@id...> - 2008年12月10日 22:19:32
It seems like there ought to be an easy way to associate labels with 
the various groups of patches generated by a call to hist() that uses 
a list of arrays, setting label=["a", "list", "of", "strings"] for 
instance, instead of having to go in and label one patch from each 
returned list of patches afterward. Would make legend creation easier 
anyway.
Just a suggestion,
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Sara H. <sar...@gm...> - 2008年12月10日 22:18:28
I ran into a little problem when adding an axis span (both vertical and
horizontal) to my plot. When I use the optional keyword arguments, I get an
error message:
import pylab
pylab.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/lib/python2.5/site-packages/matplotlib/pyplot.py", line 1572, in
axhspan
 ret = gca().axhspan(*args, **kwargs)
 File "/lib/python2.5/site-packages/matplotlib/axes.py", line 2883, in
axhspan
 self._process_unit_info( [xmin, xmax], [ymin, ymax], **kwargs )
TypeError: _process_unit_info() got an unexpected keyword argument 'alpha'
Granted, I can get the results I want using the .set_xxx() methods, but my
first method should have worked, right?
I've never filed a bug for matplotlib before, so I figured I'd send out an
email to the users-group first.
Thanks,
Sara
5 messages has been excluded from this view by a project administrator.

Showing results of 432

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