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

Showing 9 results of 9

From: Mike A. <mba...@wi...> - 2009年10月22日 20:19:12
> If you want to have a legend for PolyCollection, you may use a proxy 
> artist.
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
Thanks for the link! Although, it seems that legend does not support 
PolyCollection at all:
 "Remember that some pyplot commands return artist not supported by 
legend, e.g., fill_between() returns PolyCollection that is not 
supported."
so that even trying to use a proxy artist results in an error (shown 
at bottom), with the code here:
------------------------------
listOfThingsPlotted = []
listOfLegendLabels = []
for column in sorted(yValues):
 temp = ax.fill_between(xValues, yValues[column], label=column)
 listOfThingsPlotted.append(temp)
 listOfLegendLabels.append(column)
 legend = plt.legend 
(listOfThingsPlotted,listOfLegendLabels,bbox_to_anchor=(1.25, 1), 
shadow=True, fancybox=True)
------------------------------
Error:
------------------------------
Traceback (most recent call last):
 File "/cms/cmsprod/bin/prodJobMonitorPlots_matplotlib.py", line 
117, in <module>
 plotStackedJobsVsTime(inputFile, outputFile, outputTitle)
 File "/cms/cmsprod/bin/prodJobMonitorPlots_matplotlib.py", line 93, 
in plotStackedJobsVsTime
 legend = plt.legend 
(listOfThingsPlotted,listOfLegendLabels,bbox_to_anchor=(1.25, 1), 
shadow=True, fancybox=True) # Make legend
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
pyplot.py", line 2437, in legend
 ret = gca().legend(*args, **kwargs)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
axes.py", line 4044, in legend
 self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
legend.py", line 304, in __init__
 self._init_legend_box(handles, labels)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
legend.py", line 582, in _init_legend_box
 handlebox.add_artist(handle)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
offsetbox.py", line 475, in add_artist
 a.set_transform(self.get_transform())
AttributeError: 'NoneType' object has no attribute 'set_transform'
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 18:17:09
I guess you need to update the canvas itself, but there could be more
things to do.
My recommendation is not to switch figure, but to switch axes (or just
contours).
You may create several axes in a same figure and make them invisible
(or temporarily remove them from the figure) except the one you want.
Regards,
-JJ
On Tue, Oct 20, 2009 at 9:15 PM, Jason Kenney <jas...@gm...> wrote:
>
> I'm new to matplotlib and python GUIs in general, so I apologize if I'm
> missing something fundamental in my understanding of the matplotlib canvas -
> figure - etc model. That said...
>
> I'm working on a small matplotlib app using PyQT4. It involves selecting an
> arbitrary number of data files and breaking each down into a group of 6
> contour subplots. I want to be able to switch between contour plots from
> each data set quickly to compare and contrast, so my thought was to
> front-load the data analysis and figure creation and store them, then update
> the displayed figure with a stored figure. I am not able to get the stored
> figures to display though.
>
> In attempt to debug/understand what's going on, I have the following:
>
> class InputWindow (QtGui.QWidget):
> def __init__ (self, parent=None):
> ...
>  self.dpi = 100
>  self.fig = Figure((9.0, 6.0), dpi=self.dpi)
>  self.canvas = FigureCanvas(self.fig)
>
>  self.vbox = QtGui.QVBoxLayout()
>  self.vbox.addLayout (grid)
>  self.vbox.addLayout (self.hbox_pbs)
>  self.vbox.addWidget (self.canvas)
>  self.vbox.addStretch (1)
>  self.setLayout (self.vbox)
>  self.resize (900, 600)
>  self.fig.add_subplot(111, aspect='equal')
> ...
>
> This works fine and creates an empty plot. I can clear this figure with
> self.fig.clear() and add subplots to it with self.fig.add_subplot upon
> pushing a button in the UI. What I can't do is something like this:
>
> def Process (self):
>  self.fig.clear()
>  fig2 = Figure((9.0, 6.0), dpi=self.dpi)
>  fig2.add_subplot(211, aspect='equal')
>  self.fig = fig2
>  self.canvas.draw()
>
> This will clear the figure, but it doesn't update with the contents of fig2.
> If I look at the properties of self.fig, they match those of fig2 though.
> Any help on what I need to do to get something like self.fig = fig2 working?
>
> Thanks,
>
> J
> --
> View this message in context: http://www.nabble.com/Setting-Figure-%3D-Figure-possible--tp25985129p25985129.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 18:10:11
> Why is that?
"fill" creates Patches
(http://matplotlib.sourceforge.net/api/artist_api.html?highlight=patch#matplotlib.patches.Patch)
but fill_between creates PolyCollection
(http://matplotlib.sourceforge.net/api/collections_api.html?highlight=polycollection#matplotlib.collections.PolyCollection).
And, unfortunately, PolyCollection is currently not supported with
legend (it would be better if the error message is more meaningful
though).
If you want to have a legend for PolyCollection, you may use a proxy artist.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 17:57:59
On Thu, Oct 22, 2009 at 8:59 AM, Johan Carlin
<joh...@go...> wrote:
> 1. Is there a way to change error bar line width directly with the bar function?
Maybe not. It seems that the "bar" function currently does not return
errorbar-related artists. You can find them by looking through
axes.lines and axes.collections, but I don't recommend it.
> 2. If it is necessary to do this with errorbar(), how can I change the
> cap width or thickness?
I think it is best to use a separate errorbar function.
The error bar caps are drawn as markers. So, you need to change
marker-related attributes.
errorbar((0+w/2,1+w/2),V,e,elinewidth=3,ecolor='k',fmt=None,capsize=10, mew=5)
"mew" => "makeredgewidth"
errorbar function returns artists it creates. So, you may change
attributes of these individual artists, say, if you want different
widths for upper caps and lower caps.
See the documentation for more details.
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 17:38:01
I recommend you to open a feature request ticket on the sourceforge site.
http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse
This is more like an sphinx issue than matplotlib one, and it seems
that sphinx have some support for chm format. So I guess this could be
done quite easily. However, my observation is that most of the mpl
developers are not windows developers. So, it may not happen soon.
On the other hand, I'm personally quite satisfied with current search
functionality of the matplotlib documentation on the web. I think the
best approach would be that you describe how chm is better, and then
we (well, other developers as I know little about web development) try
to improve the web documentation.
Regards,
-JJ
On Wed, Oct 21, 2009 at 5:14 AM, NIE Cheng <nie...@gm...> wrote:
> I mean, it's quite time-consuming to find the function I want on the net
> and the pdf version is not so convenient as the chm version. Anybody any
> idea?
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Gökhan S. <gok...@gm...> - 2009年10月22日 17:23:11
On Thu, Oct 22, 2009 at 8:55 AM, clarknie <cla...@gm...> wrote:
> I mean, it's quite time-consuming to find the function I want on the net
>
> and the pdf version is not so convenient as the chm version. Anybody any
> idea?
>
>
>
Alternatively, you can check-out the source copy and build your own
documentation via Sphinx. Although the first build takes a little while
(probably no more than 10 mins, and additional builds gets very faster since
Sphinx is smart in this process) it is faster to search your local copies
than on the web.
Also, you can very easily access docstrings from within IPython. If you use
Eclipse it provides a convince of jumping function/class definitions without
locally browsing the source code as well as intelligent helpers. You may
also take a look at Spyder for ease of coding.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Gökhan
From: Dudel <Dav...@gm...> - 2009年10月22日 16:44:29
Hi,
I'm using 0.99.1.1 of matplotlib as provided by the latest Enthought Python
Distribution. When I try to plot a matrix with pyplot.imshow() I get all
kinds of error messages, unless vmin and vmax are specified. Plotting an
array instead works. I.e.:
y=matrix('1 2 3')
imshow(y) #fails
imshow(y, vmin=1, vmax=3) #works
imshow(array(y)) #works
Is that a bug?
Cheers
-- 
View this message in context: http://www.nabble.com/bug-with-imshow%28%29-for-matrix--tp26013317p26013317.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: clarknie <cla...@gm...> - 2009年10月22日 13:55:20
I mean, it's quite time-consuming to find the function I want on the net
and the pdf version is not so convenient as the chm version. Anybody any
idea?
From: Johan C. <joh...@go...> - 2009年10月22日 12:59:31
Hi all,
Changing the linewidth parameter in the bar chart function doesn't
seem to change the error bar width. E.g.
V = (.5,1.)
e = (.2,.3)
bar((0,1), V, yerr=e, linewidth=3,ecolor='k',edgecolor='k')
Produces thick lines around the bars, but thin error bars.
It's possible to get around this by defining error bars in a separate
call to errorbar with the elinewidth parameter (the error bar will
also take the linewidth parameter if undefined - this doesn't happen
with bar()). So you can add error bars to the bar chart with e.g.
w = 1.
bar((0,1), V, width=w, linewidth=3,edgecolor='k')
hold(True)
errorbar((0+w/2,1+w/2),V,e,elinewidth=3,ecolor='k',fmt=None,capsize=10)
However, this doesn't solve the problem completely, because the
resulting chart still has thin cap lines! The best workaround I've
found so far is to simply set capsize=0.
So I have two questions:
1. Is there a way to change error bar line width directly with the bar function?
2. If it is necessary to do this with errorbar(), how can I change the
cap width or thickness?
For my simple plots, life would be easier if bar() would default to
letting linewidth define thickness also for error bars and caps.
Any help would be greatly appreciated.
Best,
Johan

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