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 9 results of 9

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

Showing 9 results of 9

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 によって変換されたページ (->オリジナル) /