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




Showing 15 results of 15

From: John H. <jd...@gm...> - 2007年07月05日 20:03:38
On 7/5/07, Christian Meesters <mee...@un...> wrote:
> Hi,
>
> Is there a way to stretch letters like in this example
> http://weblogo.berkeley.edu/examples.html using mpl?
> I don't exactly want to reproduce sequence logos, but I would like to
> 'scale' a letter arbitrarily in height, changing its color and keeping
> it's width fixed.
> I didn't see things like that in mpl, yet. But I thought if somebody
> knows a way, I'd rather use the tool I like.
No, nothing short of adding some code combining agg transformations
with freetype pixel buffers which would probably require some
additional extension code to support. So you will probably be better
off with another tool for something like this for now.
Cheers,
JDH
From: Jonathan G. <gri...@co...> - 2007年07月05日 18:22:03
In message <468...@gm...>, Norbert Nemec
<Nor...@gm...> wrote
>This is the result of a change that I committed in between 0.90.0 and
>0.90.1 - sorry if it caused confusion...
>
>The idea is exactly what you observed: legend() only displays those
>lines that have an explicit label set.
>
>If a certain line in a figure does not have a label, I think it is
>rather pointless displaying it in a legend at all. I mean - the legend
>is meant to explain the individual lines and the default labels like
>"line0" can hardly be counted as "explanation".
This philosophy makes perfect sense, but it broke down for me in two
ways:
1) I am plotting 6 lines that are already associated with numbers 0
through 5, so the default labels happened to make perfect sense.
2) In this case, I use the legend not to "explain the individual lines"
but to document the line color sequence.
Obviously, this was trivial to fix now that I understand the new
behavior.
I have to say that the present behavior with no args is pretty strange:
planting a blank box on top of the middle of the plot seems worse than
useless. I personally would have preferred that it throw an exception.
>Maybe, though, there should be one additional condition:
>* If no lines or patchsets have explicit labels, display all defaults.
>* If any line or patch has an explicit label, display only the explicit
>labels.
I like this. It would avoid puzzling people who try calling legend with
no args, which would likely include people experimenting interactively
in IPython.
-- 
 Jonathan Griffitts
AnyWare Engineering Boulder, CO, USA
From: Giorgio F. G. <gi...@gi...> - 2007年07月05日 17:27:32
Ok, It seems that my problem with PS is not on matplotlib side but on
illustrator. I am able to properly open the ps file with distiller and
make a pdf out of it. The pdf will then work with illustrator too.
Don't ask me why, I couldn't figure out.
Another bug, though, comes with backend_pdf.py
The function embedPDF in the class PdfFile has a call to
encodings.cp1252.decoding_map[charcode]
but decoding_map doesn't exist. There is a decoding_table[] but it
doesn't contain good decimal unicode chars.
That makes impossible to save PDF using the last MPL, I believe.
On 7/3/07, Giorgio F. Gilestro <gi...@gi...> wrote:
> I am encountering a font problem when I try to save in .PS or .EPS format.
> I am using matplotlib 0.90 on windows xp but I had the very same
> problem with the older version too.
>
> See attached output:
> http://img207.imageshack.us/img207/3966/croppercapture11kg8.jpg
>
> Any idea?
>
> --
> Giorgio
> gi...@gi...
> http://www.cafelamarck.it
>
From: Christopher B. <Chr...@no...> - 2007年07月05日 17:09:29
Nicolas wrote:
> > as I plan to make a Qt version in the future)
> good idea.
> You mean, to use Qt instead of Wx ?
No, I'm a big wx fan. What I meant was that it's a good idea to keep 
this functionality GUI toolkit independent.
> I've found a possible solution :
looks good to me.
> buffer = self.get_renderer().buffer_rgba(0,0) # better 
> because alpha should be the last value
Why is that? Is it the "native" backend_agg format?
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Anthony M. F. <Ant...@co...> - 2007年07月05日 16:48:41
 Hi Paul,
> I would like to be able to use matplotlib as an object canvas, where=20
> items on the canvas receive mouse events (enter, leave, press,=20
> release) and the registered callback is invoked.
I do this rather extensively with the wxAgg backend and wxPython
widgets. Which backend/platform are you targeting?
> For example, I want to be able to highlight the line associated with=20
> the legend entry as I mouse over the legend, and conversely highlight=20
> the legend entry associated with the line as I mouse over the line.
> I will also want to do operations such right clicking on the axis to=20
> modify axis properties such as linear/log scale, and click on legend=20
> entries to toggle lines on and off.
These things are all do-able, but my experience has been that I've
needed to modify backend_bases.py, backend_wx.py, and backend_wxagg.py
in order to implement some of my own mouse events (double click, context
click). Further, I capture some wx events and pass them on to my
plotting canvas without using the mpl event system. As long as you
translate the pick locations properly (mpl uses lower left as =
x=3D0,y=3D0,
where wx uses upper left) it's not too difficult.
> >From looking at the pick_event_demo in examples, I have a lot of work
> ahead of me. Is this the state of the art?
Yes. Prior to 0.90 there was no pick_event at all, and doing picking
and hit testing was much more complicated. My own code existed pre 0.90
and so I have my own pick routines which work well but might be improved
by updating them to the new picker features. The problem is, of course,
that they work well enough and I've got other fish to fry.
There are quite a number of more experienced and more qualified people
on this list that also do the things you're talking about, but as far as
I know there's no "one way".
Good luck,
Anthony.
--
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
CANADA
Email: Ant...@co... | Tel: 604-822-9682
WWW: http://www.convergent.ca | Fax: 604-822-9659 =20
CMT is hiring: See http://www.convergent.ca for details
From: Christian M. <mee...@un...> - 2007年07月05日 16:37:40
Hi,
Is there a way to stretch letters like in this example
http://weblogo.berkeley.edu/examples.html using mpl? 
I don't exactly want to reproduce sequence logos, but I would like to
'scale' a letter arbitrarily in height, changing its color and keeping
it's width fixed.
I didn't see things like that in mpl, yet. But I thought if somebody
knows a way, I'd rather use the tool I like.
Christian
From: John H. <jd...@gm...> - 2007年07月05日 15:50:03
On 7/5/07, Tom Denniston <tom...@al...> wrote:
> Oops that was the TKAgg profile results. These are the WxAgg results
> attached. Sorry about that.
>
> On 7/5/07, Tom Denniston <tom...@al...> wrote:
> > I've been trying to profile and speed up an app that uses matplotlib.
> > I tried to write an example using simple pylab commands to reproduce
> > the slowness. What I found was I could get a huge speedup just
> > avoiding unnecessary redraws. I'm down now to passable behavior.
> > Plotting 6 series in two windows takes about one and a quarter
> > seconds. I would like to improve this further, however, if it is
> > possible which is why I am posting.
What is your hold state? In your test function you may want to make
sure you are not repeatedly adding data to the same figure. Eg
p1.plot(something, hold=False)
repeated calls to plot where hold is True can cause significant
slowing... In mpl hold is True by default and in matlab it is False by
default but you can set the default as an Axes property or in your rc
file.
JDH
From: Tom D. <tom...@al...> - 2007年07月05日 15:25:25
Attachments: draw.kcachegrind.gz
Oops that was the TKAgg profile results. These are the WxAgg results
attached. Sorry about that.
On 7/5/07, Tom Denniston <tom...@al...> wrote:
> I've been trying to profile and speed up an app that uses matplotlib.
> I tried to write an example using simple pylab commands to reproduce
> the slowness. What I found was I could get a huge speedup just
> avoiding unnecessary redraws. I'm down now to passable behavior.
> Plotting 6 series in two windows takes about one and a quarter
> seconds. I would like to improve this further, however, if it is
> possible which is why I am posting.
>
> The results with show() in between plots are:
>
> In [5]: run u:/tdennist/test2.py
> 10.128132637
>
> In [6]: run u:/tdennist/test2.py
> 10.3122053602
>
> And without the superfluous draws:
>
>
> In [7]: run u:/tdennist/test2.py
> 1.83904865901
>
> In [8]: run u:/tdennist/test2.py
> 1.86751011294
>
> In [9]: run u:/tdennist/test2.py
> 1.84959890227
>
>
> Where 1.85 seconds is the time to do 2 iteractions of drawing 2 plots
> with 3 lines each. So about 0.9 to 1.0 sec to draw the plots once.
>
> Is there anything obvious I can do to speed this up? I looked a
> profile results of this and found most of the time is spent in "draw"
> functions. I attached the profile results in kcachegrind format for
> the faster method.
>
> Under the animation section there is a suggestion that things are
> faster if you pre allocate the line and then just update it's x or y
> data. Given the profile results, however, I don't think this would
> help much and it would be kinda inconvenient for my app because I
> don't know how many series I am gonna plot up front.
>
> Also at the very bottom is the contents of my rc params. I am using
> WxAgg on windows with matplotlib 0.90.1 and python 2.5.
>
>
>
> Code
> -------
>
>
> import timeit
>
> setup='''
> import matplotlib
> matplotlib.use('WXAgg')
> from matplotlib.widgets import Cursor
> import pylab, numpy
> pylab.clf()
> #pylab.show()
> '''
> code='''
> fig = pylab.gcf()
> p1 = fig.add_axes([0.075, 0.05, 0.8, .4], axisbg='#333333')
> cursor = Cursor(p1, useblit=True, color='green', linewidth=2.5 )
> p2 = fig.add_axes([0.075, 0.55, 0.8, .4], axisbg='#333333')
> def test(n):
> for i in range(3):
> p1.plot(numpy.random.rand(n))
> #pylab.show()
>
> for i in range(3):
> p2.plot(numpy.random.rand(n))
> #pylab.show()
>
>
> test(1000)
> pylab.show()
> '''
>
> print timeit.Timer(code, setup=setup).timeit(2)
>
>
>
> rc Params
> ----------------
>
> figure.subplot.right 0.9
> mathtext.cal cmsy10.ttf
> font.fantasy fantasy
> xtick.minor.pad 3
> tk.pythoninspect False
> legend.labelsep 0.005
> image.aspect equal
> font.cursive cursive
> figure.subplot.hspace 0.2
> xtick.direction in
> axes.facecolor w
> ytick.direction in
> legend.pad 0.2
> axes.axisbelow False
> lines.markersize 6
> figure.dpi 80
> text.usetex False
> text.fontangle normal
> patch.edgecolor k
> ps.useafm False
> lines.solid_joinstyle miter
> font.monospace monospace
> xtick.minor.size 2
> figure.subplot.wspace 0.2
> savefig.edgecolor w
> text.fontvariant normal
> image.cmap jet
> axes.edgecolor k
> tk.window_focus False
> text.fontsize medium
> font.serif serif
> savefig.facecolor w
> ytick.minor.size 2
> mathtext.mathtext2 False
> numerix numpy
> font.stretch normal
> text.dvipnghack False
> ytick.color k
> lines.linestyle -
> xtick.color k
> xtick.major.pad 3
> text.fontweight normal
> patch.facecolor b
> figure.figsize (8, 6)
> axes.linewidth 1.0
> lines.linewidth 0.5
> savefig.dpi 150
> verbose.fileo sys.stdout
> svg.image_noscale False
> font.size 12.0
> lines.antialiased True
> polaraxes.grid True
> toolbar toolbar2
> pdf.compression 6
> grid.linewidth 0.5
> figure.facecolor 0.75
> ps.usedistiller False
> legend.isaxes True
> figure.edgecolor w
> mathtext.tt cmtt10.ttf
> contour.negative_linestyle (6.0, 6.0)
> image.interpolation bilinear
> lines.markeredgewidth 0.5
> legend.axespad 0.02
> lines.marker None
> lines.solid_capstyle projecting
> axes.titlesize large
> backend TkAgg
> xtick.major.size 5
> legend.fontsize small
> legend.shadow False
> mathtext.it cmmi10.ttf
> font.variant normal
> xtick.labelsize small
> legend.handletextsep 0.02
> ps.distiller.res 6000
> patch.linewidth 0.5
> lines.dash_capstyle butt
> lines.color b
> figure.subplot.top 0.9
> legend.markerscale 0.6
> patch.antialiased True
> font.style normal
> grid.linestyle :
> axes.labelcolor k
> text.color k
> mathtext.rm cmr10.ttf
> interactive True
> savefig.orientation portait
> svg.image_inline True
> ytick.major.size 5
> axes.grid False
> plugins.directory .matplotlib_plugins
> grid.color k
> timezone UTC
> ytick.major.pad 3
> legend.handlelen 0.05
> lines.dash_joinstyle miter
> datapath c:\local\python25\lib\site-packages\matplotlib-0.87.7-py2.5-win32.egg\matplotlib\mpl-data
> image.lut 256
> figure.subplot.bottom 0.1
> legend.numpoints 4
> font.sans-serif sans-serif
> font.family serif
> axes.labelsize medium
> ytick.minor.pad 3
> axes.hold True
> verbose.level silent
> mathtext.nonascii cmex10.ttf
> figure.subplot.left 0.125
> text.fontstyle normal
> font.weight normal
> mathtext.mit cmmi10.ttf
> ytick.labelsize small
> ps.papersize letter
> ima
> ge.origin upper
>
>
From: Tom D. <tom...@al...> - 2007年07月05日 15:22:51
Attachments: plot.kcachegrind
I've been trying to profile and speed up an app that uses matplotlib.
I tried to write an example using simple pylab commands to reproduce
the slowness. What I found was I could get a huge speedup just
avoiding unnecessary redraws. I'm down now to passable behavior.
Plotting 6 series in two windows takes about one and a quarter
seconds. I would like to improve this further, however, if it is
possible which is why I am posting.
The results with show() in between plots are:
In [5]: run u:/tdennist/test2.py
10.128132637
In [6]: run u:/tdennist/test2.py
10.3122053602
And without the superfluous draws:
In [7]: run u:/tdennist/test2.py
1.83904865901
In [8]: run u:/tdennist/test2.py
1.86751011294
In [9]: run u:/tdennist/test2.py
1.84959890227
Where 1.85 seconds is the time to do 2 iteractions of drawing 2 plots
with 3 lines each. So about 0.9 to 1.0 sec to draw the plots once.
Is there anything obvious I can do to speed this up? I looked a
profile results of this and found most of the time is spent in "draw"
functions. I attached the profile results in kcachegrind format for
the faster method.
Under the animation section there is a suggestion that things are
faster if you pre allocate the line and then just update it's x or y
data. Given the profile results, however, I don't think this would
help much and it would be kinda inconvenient for my app because I
don't know how many series I am gonna plot up front.
Also at the very bottom is the contents of my rc params. I am using
WxAgg on windows with matplotlib 0.90.1 and python 2.5.
Code
-------
import timeit
setup='''
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.widgets import Cursor
import pylab, numpy
pylab.clf()
#pylab.show()
'''
code='''
fig = pylab.gcf()
p1 = fig.add_axes([0.075, 0.05, 0.8, .4], axisbg='#333333')
cursor = Cursor(p1, useblit=True, color='green', linewidth=2.5 )
p2 = fig.add_axes([0.075, 0.55, 0.8, .4], axisbg='#333333')
def test(n):
 for i in range(3):
 p1.plot(numpy.random.rand(n))
 #pylab.show()
 for i in range(3):
 p2.plot(numpy.random.rand(n))
 #pylab.show()
test(1000)
pylab.show()
'''
print timeit.Timer(code, setup=setup).timeit(2)
rc Params
----------------
figure.subplot.right 0.9
mathtext.cal cmsy10.ttf
font.fantasy fantasy
xtick.minor.pad 3
tk.pythoninspect False
legend.labelsep 0.005
image.aspect equal
font.cursive cursive
figure.subplot.hspace 0.2
xtick.direction in
axes.facecolor w
ytick.direction in
legend.pad 0.2
axes.axisbelow False
lines.markersize 6
figure.dpi 80
text.usetex False
text.fontangle normal
patch.edgecolor k
ps.useafm False
lines.solid_joinstyle miter
font.monospace monospace
xtick.minor.size 2
figure.subplot.wspace 0.2
savefig.edgecolor w
text.fontvariant normal
image.cmap jet
axes.edgecolor k
tk.window_focus False
text.fontsize medium
font.serif serif
savefig.facecolor w
ytick.minor.size 2
mathtext.mathtext2 False
numerix numpy
font.stretch normal
text.dvipnghack False
ytick.color k
lines.linestyle -
xtick.color k
xtick.major.pad 3
text.fontweight normal
patch.facecolor b
figure.figsize (8, 6)
axes.linewidth 1.0
lines.linewidth 0.5
savefig.dpi 150
verbose.fileo sys.stdout
svg.image_noscale False
font.size 12.0
lines.antialiased True
polaraxes.grid True
toolbar toolbar2
pdf.compression 6
grid.linewidth 0.5
figure.facecolor 0.75
ps.usedistiller False
legend.isaxes True
figure.edgecolor w
mathtext.tt cmtt10.ttf
contour.negative_linestyle (6.0, 6.0)
image.interpolation bilinear
lines.markeredgewidth 0.5
legend.axespad 0.02
lines.marker None
lines.solid_capstyle projecting
axes.titlesize large
backend TkAgg
xtick.major.size 5
legend.fontsize small
legend.shadow False
mathtext.it cmmi10.ttf
font.variant normal
xtick.labelsize small
legend.handletextsep 0.02
ps.distiller.res 6000
patch.linewidth 0.5
lines.dash_capstyle butt
lines.color b
figure.subplot.top 0.9
legend.markerscale 0.6
patch.antialiased True
font.style normal
grid.linestyle :
axes.labelcolor k
text.color k
mathtext.rm cmr10.ttf
interactive True
savefig.orientation portait
svg.image_inline True
ytick.major.size 5
axes.grid False
plugins.directory .matplotlib_plugins
grid.color k
timezone UTC
ytick.major.pad 3
legend.handlelen 0.05
lines.dash_joinstyle miter
datapath c:\local\python25\lib\site-packages\matplotlib-0.87.7-py2.5-win32.egg\matplotlib\mpl-data
image.lut 256
figure.subplot.bottom 0.1
legend.numpoints 4
font.sans-serif sans-serif
font.family serif
axes.labelsize medium
ytick.minor.pad 3
axes.hold True
verbose.level silent
mathtext.nonascii cmex10.ttf
figure.subplot.left 0.125
text.fontstyle normal
font.weight normal
mathtext.mit cmmi10.ttf
ytick.labelsize small
ps.papersize letter
ima
ge.origin upper
From: John H. <jd...@gm...> - 2007年07月05日 13:25:46
On 7/5/07, Norbert Nemec <Nor...@gm...> wrote:
> Sorry, I notice that there may be need for an additional explanation:
>
> What I call "explicit label" is one that is given as kwarg to the plot
> command like
>
> plot(x,sin(x),label="sin(x)")
This works for me in svn. I also think Norbert's idea of suppressing
an auto-legend entry when there is no label is a good one. It is more
elegant and pithy than the '_nolegend_' approach, though a bit less
explicit.
JDH
From: Norbert N. <Nor...@gm...> - 2007年07月05日 13:10:19
Sorry, I notice that there may be need for an additional explanation:
What I call "explicit label" is one that is given as kwarg to the plot
command like
 plot(x,sin(x),label="sin(x)")
My standard use of legends is to give such an explicit label to every
significant line and call legend() without arguments at the end. This
approach is much more comfortable than using arguments to legend itself,
as you do not need to keep track of handles and labels with every change
that you make in the plotting script.
Greetings,
Norbert
Norbert Nemec wrote:
> This is the result of a change that I committed in between 0.90.0 and
> 0.90.1 - sorry if it caused confusion...
>
> The idea is exactly what you observed: legend() only displays those
> lines that have an explicit label set.
>
> If a certain line in a figure does not have a label, I think it is
> rather pointless displaying it in a legend at all. I mean - the legend
> is meant to explain the individual lines and the default labels like
> "line0" can hardly be counted as "explanation".
>
> Maybe, though, there should be one additional condition:
> * If no lines or patchsets have explicit labels, display all defaults.
> * If any line or patch has an explicit label, display only the explicit
> labels.
>
> This would probably avoid confusion about a completely empty legend.
> What do you think?
>
> Greetings,
> Norbert
>
>
>
>
> Jonathan Griffitts wrote:
> 
>> In matplotlib 0.90.1 the behavior of legend() seems to have changed.
>>
>> Here's a test code fragment:
>> ---------------------------
>> import pylab
>> import numpy
>>
>> y=numpy.arange(-10,10)**2
>> print y
>> pylab.plot(y)
>> pylab.legend()
>> pylab.show()
>> ---------------------------
>> Running on python 2.5.1, matplotlib 0.90.0 gives me a reasonable-looking
>> legend in upper right corner with label "line0".
>>
>> matplotlib 0.90.1 gives an empty rectangular box, fairly large, right in
>> the middle of the plot.
>>
>> Attempting to move the legend with loc=2 or whatever has no effect.
>> However, giving an explicit label ( pylab.legend(['line1']) ) makes it
>> start working the same as 0.90.0.
>>
>> I started looking at the source but don't have time today to understand
>> how this is supposed to work. Maybe later.
>>
>>
>>
>> Is this the intended behavior? The announcement for 0.90.1 says:
>> "Display only meaningful labels when calling legend() without args."
>> It's not clear to me what this means.
>>
>> 
>> 
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Norbert N. <Nor...@gm...> - 2007年07月05日 13:02:32
This is the result of a change that I committed in between 0.90.0 and
0.90.1 - sorry if it caused confusion...
The idea is exactly what you observed: legend() only displays those
lines that have an explicit label set.
If a certain line in a figure does not have a label, I think it is
rather pointless displaying it in a legend at all. I mean - the legend
is meant to explain the individual lines and the default labels like
"line0" can hardly be counted as "explanation".
Maybe, though, there should be one additional condition:
* If no lines or patchsets have explicit labels, display all defaults.
* If any line or patch has an explicit label, display only the explicit
labels.
This would probably avoid confusion about a completely empty legend.
What do you think?
Greetings,
Norbert
Jonathan Griffitts wrote:
> In matplotlib 0.90.1 the behavior of legend() seems to have changed.
>
> Here's a test code fragment:
> ---------------------------
> import pylab
> import numpy
>
> y=numpy.arange(-10,10)**2
> print y
> pylab.plot(y)
> pylab.legend()
> pylab.show()
> ---------------------------
> Running on python 2.5.1, matplotlib 0.90.0 gives me a reasonable-looking
> legend in upper right corner with label "line0".
>
> matplotlib 0.90.1 gives an empty rectangular box, fairly large, right in
> the middle of the plot.
>
> Attempting to move the legend with loc=2 or whatever has no effect.
> However, giving an explicit label ( pylab.legend(['line1']) ) makes it
> start working the same as 0.90.0.
>
> I started looking at the source but don't have time today to understand
> how this is supposed to work. Maybe later.
>
>
>
> Is this the intended behavior? The announcement for 0.90.1 says:
> "Display only meaningful labels when calling legend() without args."
> It's not clear to me what this means.
>
> 
From: Edin S. <edi...@gm...> - 2007年07月05日 09:35:44
Hi Nils,
It seems there's a problem with some of the text instances (label,
title etc.) that have TeX expressions in them.
You can also attach the problematic script (or part of it) here.
Best,
Edin
On 7/5/07, Nils Wagner <nw...@ia...> wrote:
> Hi all,
>
> I rerun a program which I have written one year ago.
> Now It doesn't work for me with the latest svn version.
> Here is the output
> python lshape.py --verbose-helpful
> $HOME=/home/nwagner
> CONFIGDIR=/home/nwagner/.matplotlib
> matplotlib data path /usr/lib64/python2.4/site-packages/matplotlib/mpl-data
> loaded rc file /home/nwagner/.matplotlib/matplotlibrc
> matplotlib version 0.90.1
> verbose.level helpful
> interactive is False
> units is False
> platform is linux2
> numerix numpy 1.0.4.dev3880
> font search path
> ['/usr/lib64/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf',
> '/usr/lib64/python2.4/site-packages/matplotlib/mpl-data/fonts/afm']
> loaded ttfcache file /home/nwagner/.matplotlib/ttffont.cache
> backend WXAgg version 2.6.1.0
> Traceback (most recent call last):
> File "lshape.py", line 136, in ?
> show()
> File
> "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_wx.py",
> line 1246, in show
> figwin.canvas.draw()
> File
> "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_wxagg.py",
> line 61, in draw
> FigureCanvasAgg.draw(self)
> File
> "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
> line 392, in draw
> self.figure.draw(renderer)
> File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line
> 601, in draw
> for a in self.axes: a.draw(renderer)
> File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line
> 1356, in draw
> a.draw(renderer)
> File "/usr/lib64/python2.4/site-packages/matplotlib/axis.py", line
> 635, in draw
> self.label.draw(renderer)
> File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line
> 410, in draw
> bbox, info = self._get_layout(renderer)
> File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line
> 254, in _get_layout
> w,h = renderer.get_text_width_height(
> File
> "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
> line 245, in get_text_width_height
> width, height, fonts = math_parse_s_ft2font(
> File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
> 1585, in __call__
> expression.parseString( s )
> File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
> line 622, in parseString
> loc, tokens = self.parse( instring.expandtabs(), 0 )
> File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
> line 564, in parse
> loc,tokens = self.parseImpl( instring, loc, doActions )
> File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
> line 1863, in parseImpl
> loc, tokens = self.expr.parse( instring, loc, doActions )
> File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
> line 564, in parse
> loc,tokens = self.parseImpl( instring, loc, doActions )
> File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
> line 1548, in parseImpl
> raise maxException
> matplotlib.pyparsing.ParseException: Expected "\" (at char 0), (line:1,
> col:1)
>
> Any pointer would be appreciated.
>
> Nils
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Nils W. <nw...@ia...> - 2007年07月05日 08:56:26
Hi all,
I rerun a program which I have written one year ago.
Now It doesn't work for me with the latest svn version.
Here is the output
python lshape.py --verbose-helpful
$HOME=/home/nwagner
CONFIGDIR=/home/nwagner/.matplotlib
matplotlib data path /usr/lib64/python2.4/site-packages/matplotlib/mpl-data
loaded rc file /home/nwagner/.matplotlib/matplotlibrc
matplotlib version 0.90.1
verbose.level helpful
interactive is False
units is False
platform is linux2
numerix numpy 1.0.4.dev3880
font search path
['/usr/lib64/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf',
'/usr/lib64/python2.4/site-packages/matplotlib/mpl-data/fonts/afm']
loaded ttfcache file /home/nwagner/.matplotlib/ttffont.cache
backend WXAgg version 2.6.1.0
Traceback (most recent call last):
 File "lshape.py", line 136, in ?
 show()
 File
"/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_wx.py",
line 1246, in show
 figwin.canvas.draw()
 File
"/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_wxagg.py",
line 61, in draw
 FigureCanvasAgg.draw(self)
 File
"/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 392, in draw
 self.figure.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line
601, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line
1356, in draw
 a.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/axis.py", line
635, in draw
 self.label.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line
410, in draw
 bbox, info = self._get_layout(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line
254, in _get_layout
 w,h = renderer.get_text_width_height(
 File
"/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 245, in get_text_width_height
 width, height, fonts = math_parse_s_ft2font(
 File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
1585, in __call__
 expression.parseString( s )
 File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
line 622, in parseString
 loc, tokens = self.parse( instring.expandtabs(), 0 )
 File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
line 564, in parse
 loc,tokens = self.parseImpl( instring, loc, doActions )
 File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
line 1863, in parseImpl
 loc, tokens = self.expr.parse( instring, loc, doActions )
 File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
line 564, in parse
 loc,tokens = self.parseImpl( instring, loc, doActions )
 File "/usr/lib64/python2.4/site-packages/matplotlib/pyparsing.py",
line 1548, in parseImpl
 raise maxException
matplotlib.pyparsing.ParseException: Expected "\" (at char 0), (line:1,
col:1)
Any pointer would be appreciated.
Nils
From: Benoit D. <Ben...@uc...> - 2007年07月05日 07:53:22
Eric,
> Regarding your modification of linewidth, do you think this really =20
> needs to be yet another kwarg,
That's what I did (I'm not a Python expert). IMHO, this is more =20
consistent with the existing methods (such as plot() or errorbar() ).
> or is it adequate to be able to adjust the linewidth with a line of =20=
> user code after calling boxplot? The method returns a dictionary =20
> with the various lists of line objects that have been drawn, so any =20=
> properties of those objects can be altered.
I didn't think to change properties of returned objects
Benoit
>
> Perhaps a more thorough updating of boxplot would use collections =20
> instead of lists of lines. Any volunteers? I am not going to do =20
> it. This would speed it up for cases with many points, but maybe =20
> boxplot is normally used with few enough points that this doesn't =20
> matter.
>
> Eric
>
> Benoit Donnet wrote:
>> Guys,
>>> Is it possible
>>> to increase the linewidth of the box plot (and change the color -
>>> i.e., from blue to black)? In the documentation, I don't see any
>>> option for boxplot regarding that point (the "widths" option refers
>>> to the width of the box, not the line).
>> Looking in the matplotlib-devel mailing-list, I found a brand new =20=
>> version of the boxplot method (written by Rob Clewley). This =20
>> method allows me to have a monochrome plot. This is quite better.
>> I then modified Rob's code for getting linewidth (that's 100% =20
>> hacking - I'm not proud of it).
>> Sorry for the disturbance.
>> Benoit
>>> I agree it is a cosmetic question but I think it would be better =20
>>> in a
>>> paper if I can change the linewidth and color.
>>>
>>> Thanks in advance.
>>>
>>> Keep on rockin'
>>>
>>> Benoit
>>>
>>> Le 03-juil.-07 =E0 19:52, Jeff Whitaker a =E9crit :
>>>
>>>> Benoit Donnet wrote:
>>>>> Hey guys,
>>>>>
>>>>> I'm trying to plot quantiles information (percentile 10, 25, 50,
>>>>> 75 and 90). Attached, you'll find a jpged of what I would like to
>>>>> do (this was done using Gnuplot): the vertical line delineates the
>>>>> range from the 10th to the 90th percentile. Small tick bars to
>>>>> either side of the lines mark some additional percentiles: bar to
>>>>> the left for the 25th and bar to the right for the 75th. Finally,
>>>>> dots mark the median.
>>>>>
>>>>> I attempted to use matplotlib.finance modules. In particular, the
>>>>> candlestick stuffs are quite close to what I want. But it didn't
>>>>> work as the X-Axis does not correspond to a date information (X-
>>>>> Axis values are within the range [1:1780]).
>>>>>
>>>>> Have you got an idea on how I can plot that using matplotlib?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Keep on rockin'
>>>>>
>>>>> Benoit
>>>>>
>>>> Benoit: This looks very similar to what the boxplot function does
>>>> (see http://matplotlib.sourceforge.net/matplotlib.pylab.html#-
>>>> boxplot and boxplot_demo.py). If you want to tweak it, the boxplot
>>>> function in axes.py might be a good starting point.
>>>>
>>>> -Jeff
>>>>
>>>> --=20
>>>> Jeffrey S. Whitaker Phone : (303)497-6313
>>>> Meteorologist FAX : (303)497-6449
>>>> NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
>>>> 325 Broadway Office : Skaggs Research Cntr 1D-124
>>>> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>>>>
>>> --
>>> Dr. Benoit Donnet
>>> Universit=E9 Catholique de Louvain (UCL)
>>> Facult=E9 des Sciences Appliqu=E9es - D=E9partement d'Ing=E9nierie
>>> Informatique (INGI)
>>> Place Sainte Barbe, 2
>>> 1348 Louvain-la-Neuve
>>> Belgium
>>> Phone: +32 10 47 87 18
>>> Home page: http://inl.info.ucl.ac.be/donnet
>>>
>>>
>>>
>>>
>>> --------------------------------------------------------------------=20=
>>> -- ---
>>> This SF.net email is sponsored by DB2 Express
>>> Download DB2 Express C - the FREE version of DB2 express and take
>>> control of your XML. No limits. Just data. Click to get it now.
>>> http://sourceforge.net/powerbar/db2/
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> --
>> Dr. Benoit Donnet
>> Universit=E9 Catholique de Louvain (UCL)
>> Facult=E9 des Sciences Appliqu=E9es - D=E9partement d'Ing=E9nierie =20=
>> Informatique (INGI)
>> Place Sainte Barbe, 2
>> 1348 Louvain-la-Neuve
>> Belgium
>> Phone: +32 10 47 87 18
>> Home page: http://inl.info.ucl.ac.be/donnet
>> ---------------------------------------------------------------------=20=
>> ----
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Dr. Benoit Donnet
Universit=E9 Catholique de Louvain (UCL)
Facult=E9 des Sciences Appliqu=E9es - D=E9partement d'Ing=E9nierie =20
Informatique (INGI)
Place Sainte Barbe, 2
1348 Louvain-la-Neuve
Belgium
Phone: +32 10 47 87 18
Home page: http://inl.info.ucl.ac.be/donnet

Showing 15 results of 15

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /