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


Showing results of 170

<< < 1 2 3 4 5 .. 7 > >> (Page 3 of 7)
From: Skipper S. <jss...@gm...> - 2013年01月26日 23:36:14
This has been asked before, and I just filed a ticket [1]. Can anyone think
of a better way to do something like this? The fill_between below is pretty
suboptimal IMO.
import matplotlib.pyplot as plt
import numpy as np
t_sec = np.arange(6)
velocity = np.array([24., 33., 40., 45., 48., 49.])
fig, ax = plt.subplots(figsize=(10,6))
lines = ax.plot(t_sec, velocity, 'mo')
ax.margins(.01)
ax.grid(False)
ax.set_ylim(0, 53);
steps = ax.step(t_sec, velocity, where='post', color='black')
filed = ax.fill_between(np.linspace(0, 5, 1001), 0,
np.r_[np.repeat(velocity[:-1], 200), 5.])
Skipper
[1] https://github.com/matplotlib/matplotlib/issues/1709
On 2013年01月24日 5:36 AM, Benjamin Root wrote:
>
>
> On Thu, Jan 24, 2013 at 10:13 AM, Chao YUE <cha...@gm...
> <mailto:cha...@gm...>> wrote:
>
> Dear all,
>
> I upgrade my matplotlib from 1.1.1 to 1.2.0 using the command:
>
> sudo pip-python install --upgrade matplotlib
>
> it completes successfully. However I tried to
>
> import matplotlib.pyplot as plt, I get the error:
>
> /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gdk.py in
> <module>()
> 27 from matplotlib.mathtext import MathTextParser
> 28 from matplotlib.transforms import Affine2D
> ---> 29 from matplotlib.backends._backend_gdk import
> pixbuf_get_pixels_array
> 30
> 31 backend_version = "%d.%d.%d" % gtk.pygtk_version
>
>
> in my ~/.matplotlib/matplotlibrc, I am using:
> backend : GTKAgg
>
> So what backend should I choose? thanks for any help,
>
> Chao
>
>
> Did you have all of the gtk/gdk development packages installed? If the
> installer can't find them to compile _backend_gdk.so, then it wouldn't
> be made available in the install. As a work-around, you could always
> use TkAgg, as that is a pure-python backend.
No, we have a _tkagg.cpp.
qt4agg and wxagg use no extension code beyond that for agg itself.
Eric
>
> I hope that helps!
> Ben Root
From: Eric F. <ef...@ha...> - 2013年01月25日 07:28:57
On 2013年01月22日 11:50 PM, Andrew Dawson wrote:
> Hi all,
>
> [TL;DR: is it possible to control the length of the dashes in dashed
> contours, if so how?]
>
> I'd like to be able to control the length of dashes for dashed contours.
> My motivation is that I'm making a contour plot that uses dashes for the
> negative contours, and the plot needs to be a specific (small) size for
> the particular journal, so the small size of the plot makes the dashes
> look rather long and is a problem for some tight contours.
>
> I have tried using some a dashes-style argument for the linestyles
> keyword of contour but I can't get it to work (although I appreciate it
> is not documented as something one can do). For example I tried:
>
> import matplotlib.pyplot as plt
> import numpy as np
> x = y = np.linspace(-np.pi, np.pi, 100)
> X, Y = np.meshgrid(x, y)
> Z = np.sin(X) * np.cos(Y)
> plt.contour(x, y, Z, linestyles=[(3, 3)])
> plt.show()
>
> This fails at the point where I show (or save, doesn't matter which
> backend) the plot with a PyCXX error:
>
> TypeError: PyCXX: Error creating object of type
> N2Py7SeqBaseINS_6ObjectEEE from 3
>
> I've fiddled with several other styles of argument and all fail in a
> similar way.
There seems to be a nasty tangle of bugs and obsolete documentation 
here. It should be perfectly simple and straightforward, but it isn't.
https://github.com/matplotlib/matplotlib/issues/1701
Eric
>
> What I'd like to know is: is it possible to control the dash length of
> dashed contours at all? It seems like it should be as one can do this
> with lines easy enough. I looked through the code, and a dashes-style
> argument seems to get passed through the stack correctly, but fails when
> the Collection is drawn. It would be a really nice feature if this could
> be implemented in matplotlib.
>
> Thanks,
> Andrew
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Joshua K. <jjk...@gm...> - 2013年01月24日 22:15:42
From: Chao Y. <cha...@gm...> - 2013年01月24日 21:10:17
thanks Paul. You're right, I changed the setting, should work now.
Chao
On Thu, Jan 24, 2013 at 7:36 PM, Paul Hobson <pmh...@gm...> wrote:
> On Thu, Jan 24, 2013 at 9:35 AM, Chao YUE <cha...@gm...> wrote:
>
>> Dear all,
>>
>> why I can only recieve the Matplotlib-users Digest, but not the email.
>> Each time I need to go
>> http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html to
>> reply the the mail.
>> I think I must miss something?
>>
>> Chao
>>
>>
> I'm pretty sure that's a setting you selected during registration. Can you
> log into the web portal to manage your subscription?
> -paul
>
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
From: Paul H. <pmh...@gm...> - 2013年01月24日 18:36:13
On Thu, Jan 24, 2013 at 9:35 AM, Chao YUE <cha...@gm...> wrote:
> Dear all,
>
> why I can only recieve the Matplotlib-users Digest, but not the email.
> Each time I need to go
> http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html to reply
> the the mail.
> I think I must miss something?
>
> Chao
>
>
I'm pretty sure that's a setting you selected during registration. Can you
log into the web portal to manage your subscription?
-paul
From: Chao Y. <cha...@gm...> - 2013年01月24日 17:35:47
Dear all,
why I can only recieve the Matplotlib-users Digest, but not the email.
Each time I need to go
http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html to reply
the the mail.
I think I must miss something?
Chao
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
From: ChaoYue <cha...@gm...> - 2013年01月24日 17:33:13
could you try 
l = ax.legend((p1,p2),['points','point_2'],scatterpoints=2) 
I think length-1 list label make the second point omitted.
Chao
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/append-to-or-concatenate-PathCollection-objects-tp40302p40309.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Hi,
I'm having an issue with the rendering of the € sign with pdf saved
figures while it looks fine on screen or on png saved figures.
Here is a minimal pylab example, and I've attached the two output files
figure()
plot()
title(u'Cost of X in €/MWh')
savefig('Cost in euros.png') # € sign renders fine
savefig('Cost in euros.pdf') # € sign is slightly vertically shifted
I made several tests with different strings. It happens that the
vertical shift seems to relate to the '/' symbol because '€' alone or
'1ドル' renders fine. Maybe something about kerning ?
I'm using version 1.1.1rc2 from Debian testing.
In my matplotlibrc, I have a customized line related to fonts:
font.sans-serif : DejaVu Sans, sans-serif
Does this influence the pdf generation in an intrusive way ?
I'm really not familiar with how PDF files are generated. I can only
report that Okular says that the pdf indeed contains the Deja Vu font
"fully integrated", in "Type 3". I guess this means something to some
people here but not me !
best,
Pierre
On Thu, Jan 24, 2013 at 10:13 AM, Chao YUE <cha...@gm...> wrote:
> Dear all,
>
> I upgrade my matplotlib from 1.1.1 to 1.2.0 using the command:
>
> sudo pip-python install --upgrade matplotlib
>
> it completes successfully. However I tried to
>
> import matplotlib.pyplot as plt, I get the error:
>
> /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gdk.py in
> <module>()
> 27 from matplotlib.mathtext import MathTextParser
> 28 from matplotlib.transforms import Affine2D
> ---> 29 from matplotlib.backends._backend_gdk import
> pixbuf_get_pixels_array
> 30
> 31 backend_version = "%d.%d.%d" % gtk.pygtk_version
>
>
> in my ~/.matplotlib/matplotlibrc, I am using:
> backend : GTKAgg
>
> So what backend should I choose? thanks for any help,
>
> Chao
>
>
Did you have all of the gtk/gdk development packages installed? If the
installer can't find them to compile _backend_gdk.so, then it wouldn't be
made available in the install. As a work-around, you could always use
TkAgg, as that is a pure-python backend.
I hope that helps!
Ben Root
Dear all,
I upgrade my matplotlib from 1.1.1 to 1.2.0 using the command:
sudo pip-python install --upgrade matplotlib
it completes successfully. However I tried to
import matplotlib.pyplot as plt, I get the error:
/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gdk.py in
<module>()
 27 from matplotlib.mathtext import MathTextParser
 28 from matplotlib.transforms import Affine2D
---> 29 from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
 30
 31 backend_version = "%d.%d.%d" % gtk.pygtk_version
in my ~/.matplotlib/matplotlibrc, I am using:
backend : GTKAgg
So what backend should I choose? thanks for any help,
Chao
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
From: Michael D. <md...@st...> - 2013年01月23日 19:23:17
Does this pull request:
https://github.com/matplotlib/matplotlib/pull/1697
fix your issue? I have no way of knowing without a test case...
Mike
On 01/22/2013 08:33 AM, Massimiliano Costacurta wrote:
> Hello everyone,
>
> in my program I'm encountering an error when calling the function 
> axes.set_xticks (Matplotlib 1.2.0 on python 2.7-64 bit). It is really 
> difficult for me to build a test case, because my program is really 
> complex. Here is the error traceback:
>
> File "C:\Python27\Lib\site-packages\matplotlib\axes.py", line 2596, in 
> set_xticks
> return self.xaxis.set_ticks(ticks, minor=minor)
> File "C:\Python27\Lib\site-packages\matplotlib\axis.py", line 1489, in 
> set_ticks
> self.set_view_interval(min(ticks), max(ticks))
> File "C:\Python27\Lib\site-packages\matplotlib\axis.py", line 1771, in 
> set_view_interval
> max(vmin, vmax, Vmax))
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 932, in _set_intervalx
> self.invalidate()
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 131, in invalidate
> return self._invalidate_internal(value, invalidating_node=self)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 155, in _invalidate_internal
> invalidating_node=self)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 155, in _invalidate_internal
> invalidating_node=self)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 155, in _invalidate_internal
> invalidating_node=self)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 2141, in _invalidate_internal
> invalidating_node=invalidating_node)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 155, in _invalidate_internal
> invalidating_node=self)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 2141, in _invalidate_internal
> invalidating_node=invalidating_node)
> File "C:\Python27\Lib\site-packages\matplotlib\transforms.py", line 
> 153, in _invalidate_internal
> for parent in self._parents.itervalues():
> File "C:\Python27\Lib\weakref.py", line 147, in itervalues
> for wr in self.data.itervalues():
> RuntimeError: dictionary changed size during iteration
>
> I googled and found that this is a well known bug due to the use of 
> self.data.itervalues() in the for loop (i think the correct syntax 
> should be for wr in iter(self.data.items()). So I would like to point 
> out the bug (if it is) to the matplotlib guys, how can I do it?
> In the meantime, how can I work around it without changing the source 
> code?
> Thanks in advance!
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jonathan S. <js...@cf...> - 2013年01月23日 18:19:56
Sterling,
I have version 1.2.0. I read the legend guide. Which thing should be
possible? If you mean giving the points as a tuple, here's some simple
test code:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
p1 = ax.scatter([0.1],[0.5],c='r',marker='s')
p2 = ax.scatter([0.3],[0.2],c='b',marker='o')
l = ax.legend((p1,p2),['points'],scatterpoints=2)
plt.show()
I get a legend with only red squares. What I want is a legend line with
a red square and a blue circle. I can get points with different colors
if I do:
p1 = ax.scatter([0.1,0.3],[0.5,0.2],c=('r','b'),marker='s')
l = ax.legend(['points'],scatterpoints=2)
(though as far as I can tell, you can't have a sequence of marker
types).
Jon
On Wed, 2013年01月23日 at 09:57 -0800, Sterling Smith wrote:
> Jon,
> 
> What version of matplotlib do you have? According to
> http://matplotlib.org/users/legend_guide.html
> what you say should be possible in 1.2.0.
> 
> -Sterling
> 
> On Jan 23, 2013, at 9:35AM, Jonathan Slavin wrote:
> 
> > Hi,
> > 
> > I'm wondering if there is some straightforward way to combine two
> > PathCollection objects to create a new PathCollection object. My goal
> > is to include two points that use different axes (one twin'ed to the
> > other) into a single legend item (different point types, same label).
> > Each call to scatter creates a new PathCollection object. If I could
> > just combine two (or more) PathCollection objects -- either extending
> > them or concatenating or whatever -- then I could give that to legend
> > and it would work correctly. But it's not clear to me how I can do
> > that. I tried providing the two objects as a tuple to legend, but it
> > doesn't work (only point characteristics of one of them is used).
> > 
> > Really, I think this should be easier -- both the combining of such
> > objects (which after all, are collections) and providing legend with
> > simple arguments to produce what you want. As far as I can tell I can't
> > just tell leged directly the symbol type(s) and colors of point(s) per
> > each label. Though in general the automatic method whereby you provide
> > the object to the legend is nice and easy, a more crude and direct way
> > would be a good option for special cases.
> > 
> > Jon
> > -- 
> > ______________________________________________________________
> > Jonathan D. Slavin Harvard-Smithsonian CfA
> > js...@cf... 60 Garden Street, MS 83
> > phone: (617) 496-7981 Cambridge, MA 02138-1516
> > cell: (781) 363-0035 USA
> > ______________________________________________________________
> > 
> > 
> > ------------------------------------------------------------------------------
> > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > MVPs and experts. ON SALE this month only -- learn more at:
> > http://p.sf.net/sfu/learnnow-d2d
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Paul H. <pmh...@gm...> - 2013年01月23日 18:19:23
On Mon, Jan 21, 2013 at 4:28 AM, Kelson Zawack <kb...@co...> wrote:
> a heat map and want to label each row. I thus need the font
> size of the text to scale with the number of rows in the heat map. Is
>
Assuming you start out with this:
 import matplotlib.pyplot as plt
 fig, ax1 = plt.subplots()
You can then do this:
 figsize = fig.get_size_inches()
 ax_pos = ax1.get_position().get_points()
The variable figsize is now a array of the figure's width and height. And
ax_pos is an array with the first row being the x-y location of the lower
left corner of the axes on the figure in figure fraction coordinates. The
second row is the width and height of the axes, again expressed as a
fraction of the total figure dimensions.
Hope that helps,
-paul
From: Jonathan S. <js...@cf...> - 2013年01月23日 17:36:07
Hi,
I'm wondering if there is some straightforward way to combine two
PathCollection objects to create a new PathCollection object. My goal
is to include two points that use different axes (one twin'ed to the
other) into a single legend item (different point types, same label).
Each call to scatter creates a new PathCollection object. If I could
just combine two (or more) PathCollection objects -- either extending
them or concatenating or whatever -- then I could give that to legend
and it would work correctly. But it's not clear to me how I can do
that. I tried providing the two objects as a tuple to legend, but it
doesn't work (only point characteristics of one of them is used).
Really, I think this should be easier -- both the combining of such
objects (which after all, are collections) and providing legend with
simple arguments to produce what you want. As far as I can tell I can't
just tell leged directly the symbol type(s) and colors of point(s) per
each label. Though in general the automatic method whereby you provide
the object to the legend is nice and easy, a more crude and direct way
would be a good option for special cases.
Jon
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Andrew D. <da...@at...> - 2013年01月23日 10:19:04
Hi all,
[TL;DR: is it possible to control the length of the dashes in dashed
contours, if so how?]
I'd like to be able to control the length of dashes for dashed contours. My
motivation is that I'm making a contour plot that uses dashes for the
negative contours, and the plot needs to be a specific (small) size for the
particular journal, so the small size of the plot makes the dashes look
rather long and is a problem for some tight contours.
I have tried using some a dashes-style argument for the linestyles keyword
of contour but I can't get it to work (although I appreciate it is not
documented as something one can do). For example I tried:
 import matplotlib.pyplot as plt
 import numpy as np
 x = y = np.linspace(-np.pi, np.pi, 100)
 X, Y = np.meshgrid(x, y)
 Z = np.sin(X) * np.cos(Y)
 plt.contour(x, y, Z, linestyles=[(3, 3)])
 plt.show()
This fails at the point where I show (or save, doesn't matter which
backend) the plot with a PyCXX error:
 TypeError: PyCXX: Error creating object of type
N2Py7SeqBaseINS_6ObjectEEE from 3
I've fiddled with several other styles of argument and all fail in a
similar way.
What I'd like to know is: is it possible to control the dash length of
dashed contours at all? It seems like it should be as one can do this with
lines easy enough. I looked through the code, and a dashes-style argument
seems to get passed through the stack correctly, but fails when the
Collection is drawn. It would be a really nice feature if this could be
implemented in matplotlib.
Thanks,
Andrew
From: Sterling S. <sm...@fu...> - 2013年01月23日 06:34:07
On Jan 22, 2013, at 7:01PM, Benjamin Root wrote:
> 
> 
> On Tue, Jan 22, 2013 at 9:10 PM, Drain, Theodore R (343P) <the...@jp...> wrote:
> I have to say I disagree with this "fix". None was a nice, very intuitive way to hide the label. Many Python systems use None in that kind of role and I really doubt anyone is going to use None when they meant "None" so converting it to a string seems like a bad idea.
> 
> Ted
> 
> 
> IIRC, the problem is that in matplotlib, the python None has a special meaning in most places ("do the default thing"). Legends, by default, will create default labels. For some time, we were capable of distinguishing when someone submitted label=None and didn't state anything at all for labels. This often causes confusion down the draw stack, and we have been working towards getting rid of such distinctions.
> 
> Of course, this is all from memory, which is notoriously bad. If someone else can bisect the commit that changed this, maybe that can refresh my memory and maybe I could see a reason to re-instate this behavior. Also, if anyone can spot where it is stated in the documentation or examples that None acts the same as "_nolegend_", then we can consider this a regression and get it fixed.
> 
> Cheers!
> Ben Root
If None means do the default thing, then great. I always interpreted the default for a plot command (line, patch, scatter, bar, etc.) to be no legend entry, unless explicitly given. While not the specification as you have given it (default is default labels), this is my working specification (I have not yet migrated to 1.2.0).
Cheers,
Sterling
PS Notwithstanding this possible point of difference of opinion, I think the matplotlib team is awesome, and puts out a great product. So I am willing to concede the point if no reversion is made.
From: Benjamin R. <ben...@ou...> - 2013年01月23日 03:02:07
On Tue, Jan 22, 2013 at 9:10 PM, Drain, Theodore R (343P) <
the...@jp...> wrote:
> I have to say I disagree with this "fix". None was a nice, very intuitive
> way to hide the label. Many Python systems use None in that kind of role
> and I really doubt anyone is going to use None when they meant "None" so
> converting it to a string seems like a bad idea.
>
> Ted
>
>
IIRC, the problem is that in matplotlib, the python None has a special
meaning in most places ("do the default thing"). Legends, by default, will
create default labels. For some time, we were capable of distinguishing
when someone submitted label=None and didn't state anything at all for
labels. This often causes confusion down the draw stack, and we have been
working towards getting rid of such distinctions.
Of course, this is all from memory, which is notoriously bad. If someone
else can bisect the commit that changed this, maybe that can refresh my
memory and maybe I could see a reason to re-instate this behavior. Also,
if anyone can spot where it is stated in the documentation or examples that
None acts the same as "_nolegend_", then we can consider this a regression
and get it fixed.
Cheers!
Ben Root
From: Drain, T. R (343P) <the...@jp...> - 2013年01月23日 02:14:52
I have to say I disagree with this "fix". None was a nice, very intuitive way to hide the label. Many Python systems use None in that kind of role and I really doubt anyone is going to use None when they meant "None" so converting it to a string seems like a bad idea.
Ted
________________________________________
From: David Erickson [hal...@gm...]
Sent: Tuesday, January 22, 2013 4:47 PM
To: Benjamin Root
Cc: mat...@li...
Subject: Re: [Matplotlib-users] Hiding labels in a legend?
On Tue, Jan 22, 2013 at 1:20 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> On Tue, Jan 22, 2013 at 1:57 PM, David Erickson <hal...@gm...>
> wrote:
>>
>> Hello-
>> Prior to version 1.2 of MPL I was able to hide labels for certain
>> lines in the legend by setting the label=None when plotting a line,
>> however in 1.2 it is now showing the legend entry and visibly printing
>> "None". Is there a workaround to hide the label?
>>
>> Thanks,
>> David
>>
>
> I think you want "_nolegend_" for those labels. The hiding of the labels
> for None was an undocumented feature, I think, and has been "fixed".
>
> http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.legend
>
Perfect, thanks Ben!
-David
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: David E. <hal...@gm...> - 2013年01月23日 00:47:42
On Tue, Jan 22, 2013 at 1:20 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> On Tue, Jan 22, 2013 at 1:57 PM, David Erickson <hal...@gm...>
> wrote:
>>
>> Hello-
>> Prior to version 1.2 of MPL I was able to hide labels for certain
>> lines in the legend by setting the label=None when plotting a line,
>> however in 1.2 it is now showing the legend entry and visibly printing
>> "None". Is there a workaround to hide the label?
>>
>> Thanks,
>> David
>>
>
> I think you want "_nolegend_" for those labels. The hiding of the labels
> for None was an undocumented feature, I think, and has been "fixed".
>
> http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.legend
>
Perfect, thanks Ben!
-David
From: Benjamin R. <ben...@ou...> - 2013年01月22日 21:20:39
On Tue, Jan 22, 2013 at 1:57 PM, David Erickson <hal...@gm...>wrote:
> Hello-
> Prior to version 1.2 of MPL I was able to hide labels for certain
> lines in the legend by setting the label=None when plotting a line,
> however in 1.2 it is now showing the legend entry and visibly printing
> "None". Is there a workaround to hide the label?
>
> Thanks,
> David
>
>
I think you want "_nolegend_" for those labels. The hiding of the labels
for None was an undocumented feature, I think, and has been "fixed".
http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.legend
Cheers!
Ben Root
From: Jonathan S. <js...@cf...> - 2013年01月22日 21:10:43
Hi Paul,
This doesn't solve my problem since the whole point was to have two
separate x axes with different scales, etc. One thing that I found that
does help is to use the suptitle() method of figure. This at least puts
the title at the top of the figure and I can then fiddle with the top
offset for the subplot to get the title to not overlap the axis label.
Jon
On Tue, 2013年01月22日 at 13:02 -0800, Paul Hobson wrote:
> 
> On Tue, Jan 22, 2013 at 12:22 PM, Jonathan Slavin
> <js...@cf...> wrote:
> Hi,
> 
> I'm having some trouble with using twiny and a title on the
> plot. The
> title is writing over the axis label -- and even the tick
> labels. I've
> tried tight_layout() but it doesn't seem to help. I could use
> fig.text
> instead of title and place the title text where I want it
> (with a bit of
> fiddling), but it'd be nice to have a more elegant solution.
> 
> 
> Try this is a workaround:
> fig, ax1 = plt.subplots()
> ax2 = ax1.twiny()
> ax1.plot(np.random.randn(50), 'gs')
> ax2.plot(np.random.randn(50), 'bo')
> ax1.set_title('Test Title')
> ax2.xaxis.tick_bottom()
> plt.show()
> 
> Does that help?
> -paul
> 
> 
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Paul H. <pmh...@gm...> - 2013年01月22日 21:02:12
On Tue, Jan 22, 2013 at 12:22 PM, Jonathan Slavin
<js...@cf...>wrote:
> Hi,
>
> I'm having some trouble with using twiny and a title on the plot. The
> title is writing over the axis label -- and even the tick labels. I've
> tried tight_layout() but it doesn't seem to help. I could use fig.text
> instead of title and place the title text where I want it (with a bit of
> fiddling), but it'd be nice to have a more elegant solution.
>
Try this is a workaround:
fig, ax1 = plt.subplots()
ax2 = ax1.twiny()
ax1.plot(np.random.randn(50), 'gs')
ax2.plot(np.random.randn(50), 'bo')
ax1.set_title('Test Title')
ax2.xaxis.tick_bottom()
plt.show()
Does that help?
-paul
From: Jonathan S. <js...@cf...> - 2013年01月22日 20:23:04
Hi,
I'm having some trouble with using twiny and a title on the plot. The
title is writing over the axis label -- and even the tick labels. I've
tried tight_layout() but it doesn't seem to help. I could use fig.text
instead of title and place the title text where I want it (with a bit of
fiddling), but it'd be nice to have a more elegant solution.
Jon
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: David E. <hal...@gm...> - 2013年01月22日 18:57:16
Hello-
Prior to version 1.2 of MPL I was able to hide labels for certain
lines in the legend by setting the label=None when plotting a line,
however in 1.2 it is now showing the legend entry and visibly printing
"None". Is there a workaround to hide the label?
Thanks,
David

Showing results of 170

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