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



Showing 11 results of 11

From: Benjamin R. <ben...@ou...> - 2010年06月22日 23:32:18
Actually, I just re-read your original message and noticed that you were
specifying your levels (I believe). The double set of contours depends on
what your values are. If you want to make absolutely sure that there aren't
extra lines, you could contour a boolean array:
contour(x, y, z > 4.5, [0, 1])
That should do the trick as well (assuming you know the level that you want
the isopleth for).
Ben Root
On Tue, Jun 22, 2010 at 6:27 PM, Benjamin Root <ben...@ou...> wrote:
> Jon,
>
> One thing you can do is to manually specify the levels to contour for in
> the contour call, or just specify the number of contours (and contour() will
> figure out the levels for you). The fourth argument to contour() allows you
> to give a sequence of values (or an integer) for the isopleths. So, if you
> want just one line (but have it chosen automatically):
>
> contour(x, y, z, 1)
>
> If you want a contour to always be for the value of 4.5, for example, then:
>
> contour(x, y, z, [4.5])
>
> Should do the trick.
>
> I hope that helps,
> Ben Root
>
>
>
>
> On Tue, Jun 22, 2010 at 1:46 PM, Jonathan Slavin <js...@cf...>wrote:
>
>> To all:
>>
>> I'm making a plot with an image and a contour on it. I use only one
>> level in the call to contour, but it results in two distinct contours,
>> an inner closed one and an outer open one. I want to plot only the
>> outer piece. How might I go about that? I've been looking at the
>> properties of the ContourSet object returned by the call to contour but
>> can't find anything useful yet. Is there an attribute of ContourSet
>> objects that contains the (x,y) values for the contour? Is there some
>> way to see that a ContourSet object has separate pieces?
>>
>> Any help would be appreciated.
>>
>> Thanks,
>> Jon
>>
>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit. See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
From: Benjamin R. <ben...@ou...> - 2010年06月22日 23:28:00
Jon,
One thing you can do is to manually specify the levels to contour for in the
contour call, or just specify the number of contours (and contour() will
figure out the levels for you). The fourth argument to contour() allows you
to give a sequence of values (or an integer) for the isopleths. So, if you
want just one line (but have it chosen automatically):
contour(x, y, z, 1)
If you want a contour to always be for the value of 4.5, for example, then:
contour(x, y, z, [4.5])
Should do the trick.
I hope that helps,
Ben Root
On Tue, Jun 22, 2010 at 1:46 PM, Jonathan Slavin <js...@cf...>wrote:
> To all:
>
> I'm making a plot with an image and a contour on it. I use only one
> level in the call to contour, but it results in two distinct contours,
> an inner closed one and an outer open one. I want to plot only the
> outer piece. How might I go about that? I've been looking at the
> properties of the ContourSet object returned by the call to contour but
> can't find anything useful yet. Is there an attribute of ContourSet
> objects that contains the (x,y) values for the contour? Is there some
> way to see that a ContourSet object has separate pieces?
>
> Any help would be appreciated.
>
> Thanks,
> Jon
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Fa <fa...@gm...> - 2010年06月22日 21:27:26
Hi all, I am trying to figure out how I can limit the xaxis date ranges. I
tried set_xlim(), but that didn't work. The graph consists of dates for the
xaxis and data for the yaxis. Currently the xaxis is showing the entire
year's worth of months, even though there are no data for some months. This
plot is really close to what I want, however, I need to limit the xaxis to a
only a few months.
 weeks = matplotlib.dates.WeekdayLocator() # every year
 months = matplotlib.dates.MonthLocator() # every month
 monthsFmt = matplotlib.dates.DateFormatter('%b')
 fig = pylab.figure()
 ax = fig.add_subplot(111)
 ax.xaxis.set_major_locator(months)
 ax.xaxis.set_major_formatter(monthsFmt)
 ax.xaxis.set_minor_locator(weeks)
 pylab.bar(x,y)
From: Nie, J. <jn...@bn...> - 2010年06月22日 20:52:37
Super. I will need to study your solution tomorrow.
--
Jinsuo
-----Original Message-----
From: Stan West [mailto:sta...@nr...] 
Sent: Tuesday, June 22, 2010 4:41 PM
To: Nie, Jinsuo; mat...@li...
Subject: RE: [Matplotlib-users] Animated Line2D
> From: Nie, Jinsuo [mailto:jn...@bn...] 
> Sent: Tuesday, June 22, 2010 09:33
...
> I modified the path_editor.py example in order to make a line editor,
as
> attached. The path_editor.py worked fine on Qt4Agg. However, in the
> line editor, the line was not draggable on the same backend.
...
The problem seems to stem from the line not being marked invalid when
its
set_data method is called. This can be seen by modifying your
motion_notify_callback method as follows; I removed the previous print
statements and inserted a new one:
 def motion_notify_callback(self, event):
 'on mouse movement'
 if not self.showverts: return
 if self._ind is None: return
 if event.inaxes is None: return
 if event.button != 1: return
 x,y = self.line.get_data()
 x[self._ind] = event.xdata
 y[self._ind] = event.ydata
 self.line.set_data(x, y)
 print self.line._invalid
 self.canvas.restore_region(self.background)
 self.ax.draw_artist(self.line)
 self.canvas.blit(self.ax.bbox)
The x returned by get_data is the same object as line._xorig (a private
attribute of the line object), so the changes you make to elements of x
also
apply to _xorig. Then, set_data compares the incoming x with _xorig,
sees
that they are the same object, and doesn't set the _invalid attribute to
True.
With _invalid still False, the line is not redrawn.
I tested on Windows 7 with matplotlib 0.99.1 (and saw the same behavior
you
did). The relevant code in matplotlib's lines.py was changed in
revision 8054
(if I'm interpreting correctly), and that's why John saw the animation
using
more recent matplotlib code. I checked the last released version
(0.99.3) and
found the same code for set_data as in 0.99.1, so updating to 0.99.3
won't
help.
However, I see two alternative easy solutions. (1) After calling
self.line.set_data, call self.line.recache, which is what would happen
automatically if the _invalid attribute were True. (2) Call set_data
with
different objects than the ones you received from get_data. For
example:
 vertices = zip(*self.line.get_data())
 vertices[self._ind] = event.xdata, event.ydata
 self.line.set_data(zip(*vertices))
The set_data method will then set _invalid to True, enabling the line to
be
redrawn.
From: Stan W. <sta...@nr...> - 2010年06月22日 20:41:21
> From: Nie, Jinsuo [mailto:jn...@bn...] 
> Sent: Tuesday, June 22, 2010 09:33
...
> I modified the path_editor.py example in order to make a line editor, as
> attached. The path_editor.py worked fine on Qt4Agg. However, in the
> line editor, the line was not draggable on the same backend.
...
The problem seems to stem from the line not being marked invalid when its
set_data method is called. This can be seen by modifying your
motion_notify_callback method as follows; I removed the previous print
statements and inserted a new one:
 def motion_notify_callback(self, event):
 'on mouse movement'
 if not self.showverts: return
 if self._ind is None: return
 if event.inaxes is None: return
 if event.button != 1: return
 x,y = self.line.get_data()
 x[self._ind] = event.xdata
 y[self._ind] = event.ydata
 self.line.set_data(x, y)
 print self.line._invalid
 self.canvas.restore_region(self.background)
 self.ax.draw_artist(self.line)
 self.canvas.blit(self.ax.bbox)
The x returned by get_data is the same object as line._xorig (a private
attribute of the line object), so the changes you make to elements of x also
apply to _xorig. Then, set_data compares the incoming x with _xorig, sees
that they are the same object, and doesn't set the _invalid attribute to True.
With _invalid still False, the line is not redrawn.
I tested on Windows 7 with matplotlib 0.99.1 (and saw the same behavior you
did). The relevant code in matplotlib's lines.py was changed in revision 8054
(if I'm interpreting correctly), and that's why John saw the animation using
more recent matplotlib code. I checked the last released version (0.99.3) and
found the same code for set_data as in 0.99.1, so updating to 0.99.3 won't
help.
However, I see two alternative easy solutions. (1) After calling
self.line.set_data, call self.line.recache, which is what would happen
automatically if the _invalid attribute were True. (2) Call set_data with
different objects than the ones you received from get_data. For example:
 vertices = zip(*self.line.get_data())
 vertices[self._ind] = event.xdata, event.ydata
 self.line.set_data(zip(*vertices))
The set_data method will then set _invalid to True, enabling the line to be
redrawn.
From: Jonathan S. <js...@cf...> - 2010年06月22日 18:46:43
To all:
I'm making a plot with an image and a contour on it. I use only one
level in the call to contour, but it results in two distinct contours,
an inner closed one and an outer open one. I want to plot only the
outer piece. How might I go about that? I've been looking at the
properties of the ContourSet object returned by the call to contour but
can't find anything useful yet. Is there an attribute of ContourSet
objects that contains the (x,y) values for the contour? Is there some
way to see that a ContourSet object has separate pieces?
Any help would be appreciated.
Thanks,
Jon
From: Michael D. <md...@st...> - 2010年06月22日 16:22:36
On 06/22/2010 11:39 AM, Benjamin Root wrote:
>
>
> On Tue, Jun 22, 2010 at 3:45 AM, Matthias Michler 
> <Mat...@gm... <mailto:Mat...@gm...>> wrote:
>
> On Tuesday, June 22, 2010 10:03:06 am Eric Firing wrote:
> > On 06/21/2010 09:28 PM, Matthias Michler wrote:
> > > On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:
> > >> On 06/21/2010 06:10 AM, Matthias Michler wrote:
> > >>> Hello list,
> > >>>
> > >>> I'm encountering a strange problem with the
> RectangleSelector using the
> > >>> latest version of svn. Namely it doesn't work if it wasn't
> initialized
> > >>> as RS = RectangleSelector(...)
> > >>> but using
> > >>> RectangleSelector(...)
> > >>> in my script.
> > >>>
> > >>> I modified the example rectangle_selector.py from the folder
> > >>> examples/widgets to illustrate my observation.
> > >>>
> > >>> Can anybody reproduce my findings or even explain what is
> going on?
> > >>
> > >> If you don't keep a reference to the RectangleSelector object, it
> > >> vanishes--it is garbage-collected.
> > >>
> > >> Eric
> > >
> > > Hi Eric,
> > >
> > > thanks for your reply. That sounds reasonable, but I'm still
> confused.
> > > With the matplotlib release 0.99.1.1 the RectangleSelector
> works with
> > > and without a reference to it. Was this old behavior somehow
> unintended?
>
> Hi Eric,
>
> > I don't know. In both cases, are you trying it in a script, and
> running
> > it outside ipython? Ipython keeps references to inputs and outputs.
>
> yes I'm just using
>
> python rectangle_selector.py
>
> with the slightly modified script I have sent last time for
> matplotlib-svn and
> additionally comment out the 'button' - keyword argument for the
> release
> 0.99.1.1. The only difference between the two runs is whether
> matplotlib-svn is
> found in the PYTHONPATH or not.
>
> > There haven't been many changes to widgets.py, and I don't see
> anything
> > that could account for the difference I also don't see what
> could keep
> > it alive if you don't keep a reference to it.
> >
> > If the same externally-run script works differently in this respect
> > between the two mpl versions, then I'm baffled.
>
> I'm baffled, too. That was what made starting this thread and hope
> for an
> explanation, what I'm doing wrong.
>
> Kind regards,
> Matthias
>
>
> I could have sworn that there was a bug fix a month or two ago dealing 
> with what appeared to be a memory leak of some sort. It seemed that 
> some stuff was not getting garbage-collected because they weren't 
> completely dereferenced. I seem to recall that it had something to do 
> with various backend action callbacks not being dis-connected when 
> finished (or the action was being connected too many times).
>
> Maybe that might explain the difference in behavior (that is, that the 
> old behavior was a "bug" not a "feature")?
Yes, precisely.
Mike
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Benjamin R. <ben...@ou...> - 2010年06月22日 15:39:33
On Tue, Jun 22, 2010 at 3:45 AM, Matthias Michler
<Mat...@gm...>wrote:
> On Tuesday, June 22, 2010 10:03:06 am Eric Firing wrote:
> > On 06/21/2010 09:28 PM, Matthias Michler wrote:
> > > On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:
> > >> On 06/21/2010 06:10 AM, Matthias Michler wrote:
> > >>> Hello list,
> > >>>
> > >>> I'm encountering a strange problem with the RectangleSelector using
> the
> > >>> latest version of svn. Namely it doesn't work if it wasn't
> initialized
> > >>> as RS = RectangleSelector(...)
> > >>> but using
> > >>> RectangleSelector(...)
> > >>> in my script.
> > >>>
> > >>> I modified the example rectangle_selector.py from the folder
> > >>> examples/widgets to illustrate my observation.
> > >>>
> > >>> Can anybody reproduce my findings or even explain what is going on?
> > >>
> > >> If you don't keep a reference to the RectangleSelector object, it
> > >> vanishes--it is garbage-collected.
> > >>
> > >> Eric
> > >
> > > Hi Eric,
> > >
> > > thanks for your reply. That sounds reasonable, but I'm still confused.
> > > With the matplotlib release 0.99.1.1 the RectangleSelector works with
> > > and without a reference to it. Was this old behavior somehow
> unintended?
>
> Hi Eric,
>
> > I don't know. In both cases, are you trying it in a script, and running
> > it outside ipython? Ipython keeps references to inputs and outputs.
>
> yes I'm just using
>
> python rectangle_selector.py
>
> with the slightly modified script I have sent last time for matplotlib-svn
> and
> additionally comment out the 'button' - keyword argument for the release
> 0.99.1.1. The only difference between the two runs is whether
> matplotlib-svn is
> found in the PYTHONPATH or not.
>
> > There haven't been many changes to widgets.py, and I don't see anything
> > that could account for the difference I also don't see what could keep
> > it alive if you don't keep a reference to it.
> >
> > If the same externally-run script works differently in this respect
> > between the two mpl versions, then I'm baffled.
>
> I'm baffled, too. That was what made starting this thread and hope for an
> explanation, what I'm doing wrong.
>
> Kind regards,
> Matthias
>
>
I could have sworn that there was a bug fix a month or two ago dealing with
what appeared to be a memory leak of some sort. It seemed that some stuff
was not getting garbage-collected because they weren't completely
dereferenced. I seem to recall that it had something to do with various
backend action callbacks not being dis-connected when finished (or the
action was being connected too many times).
Maybe that might explain the difference in behavior (that is, that the old
behavior was a "bug" not a "feature")?
Ben Root
From: Nie, J. <jn...@bn...> - 2010年06月22日 14:00:56
Attachments: line_editor.py
I am reposting my problem since I have not been able to solve it myself.
I guess my original question has been buried deeply in this list.
I modified the path_editor.py example in order to make a line editor, as
attached. The path_editor.py worked fine on Qt4Agg. However, in the
line editor, the line was not draggable on the same backend. The
printout showed that the line (nodal coordinates) had been updated but
it was not redrawn in the axes. I also tested the line editor on WXAgg
and TkAgg and it did not work either. I am using Windows 7.
John Hunter tested this line editor on his system and found it was
working properly. I wonder whether this is a issue of backend/os. I
would like invite people to simply run this script and report your
successfulness and your backend/os. It will be especially useful for me
if you are using Qt4Agg on Windows 7. 
Thank you very much.
--
Jinsuo
From: Friedrich R. <fri...@gm...> - 2010年06月22日 10:19:28
Many apologises for the slow response ...
I'm quite convinced the path is not an issue.
2010年6月19日 Hana Sevcikova <ha...@cs...>:
> I see there are some compatibility issues. What would be the best way to
> deal with it?
This should be the issue. I think usually the matplotlib binaries are
linked against the same libraries as the Python binaries to avoid such
trouble, but for the 10.6 issue this went wrong somehow? I don't
know.
A possibility would be to compile Python and matplotlib yourself.
This can, for matplotlib, be somewhat troublesome. There is a
recommended way via the make.osx script, and "my" way via tweaking of
the config files. The recommended way downloads freetype2 etc. into a
local directory and does afaik hard linking, "my" way links it the
usual dynamic way against system-wide installed libraries. The
make.osx way is way from perfect, but it should work, albeit I
personally like the other way much more, since it appears much more
clean to me. Tell me what you prefer. If you prefer "my" way, I will
give you detailed instructions, with the make.osx way I'm neither
comfortable nor acquainted, maybe John can help you then. There's
also a recent thread about building matplotlib on Mac (10.6 if I'm not
mistaken) with make.osx.
Friedrich
From: Eric F. <ef...@ha...> - 2010年06月22日 08:03:15
On 06/21/2010 09:28 PM, Matthias Michler wrote:
> On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:
>> On 06/21/2010 06:10 AM, Matthias Michler wrote:
>>> Hello list,
>>>
>>> I'm encountering a strange problem with the RectangleSelector using the
>>> latest version of svn. Namely it doesn't work if it wasn't initialized
>>> as RS = RectangleSelector(...)
>>> but using
>>> RectangleSelector(...)
>>> in my script.
>>>
>>> I modified the example rectangle_selector.py from the folder
>>> examples/widgets to illustrate my observation.
>>>
>>> Can anybody reproduce my findings or even explain what is going on?
>>
>> If you don't keep a reference to the RectangleSelector object, it
>> vanishes--it is garbage-collected.
>>
>> Eric
>
> Hi Eric,
>
> thanks for your reply. That sounds reasonable, but I'm still confused. With
> the matplotlib release 0.99.1.1 the RectangleSelector works with and without a
> reference to it. Was this old behavior somehow unintended?
I don't know. In both cases, are you trying it in a script, and running 
it outside ipython? Ipython keeps references to inputs and outputs.
There haven't been many changes to widgets.py, and I don't see anything 
that could account for the difference. I also don't see what could keep 
it alive if you don't keep a reference to it.
If the same externally-run script works differently in this respect 
between the two mpl versions, then I'm baffled.
Eric
>
> Kind regards,
> Matthias
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
2 messages has been excluded from this view by a project administrator.

Showing 11 results of 11

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