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






Showing results of 276

<< < 1 .. 9 10 11 12 > >> (Page 11 of 12)
From: Sterling S. <sm...@fu...> - 2012年09月04日 21:06:00
On Aug 31, 2012, at 11:29AM, Goyo wrote:
> 2012年8月30日 Sterling Smith <sm...@fu...>:
> 
>> Thank you for taking the time to consider my question. I'm sorry that I didn't pose my question correctly. I should have said: 'Consider the _results_ of the following script:' I originally tried to attach the results I obtained, which showed no change in color for the markers in the legend, while the line connecting the markers in the legend did change color.
> 
> Actualy your question is correctly posted but I misread it. Calling
> set_color changes only the line color, not the markers. This is
> expected and documented behavoir. There are separate methods for the
> markers:
> 
> line[0].set_markerfacecolor
> line[0].set_markeredgecolor
> 
> See http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D
> 
> Regards
> 
> Goyo
Goyo,
Again I thank you for taking time to look into this. You are correct that there are separate functions for setting the marker properties vs the line properties. However, I have tried your solution, and it does not work. Given the following code:
import pylab
pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='')
pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-')
leg=pylab.legend(loc='best')
line=leg.get_lines()
line[0].set_markerfacecolor('black')
line[1].set_markerfacecolor('black')
pylab.draw()
I still do not get black markers. Furthermore, if you try to make a new legend with the result of leg.get_lines(), you will get lines without markers, which leads me to the conclusion I stated in my previous email (which you did not copy)
>> I suspect that this is because the legend marker is drawn separately from the legend line to accommodate the numpoints argument of the legend functions. Then the question is how to access these markers if they are separate from the line2d objects in the legend. I didn't even see them in the children of the legend [legend.get_children()].
Thanks,
Sterling
From: Benjamin R. <ben...@ou...> - 2012年09月04日 19:56:50
On Fri, Aug 24, 2012 at 12:21 PM, John Bluee <b7...@gm...> wrote:
> I have lat and lon as coordinates and to each point a value. So far I use
> contourf to plot.
>
>
Sorry for not getting back to you sooner. May I suggest the following:
values = np.ma.masked_outside(values, -1e-8, 1e-9, copy=False)
values = np.ma.masked_inside(values, -1e-14, 1e14, copy=False)
And then contourf the masked values array. Any places where the values are
masked will be blank.
I hope this helps!
Ben Root
From: Drain, T. R (343P) <the...@jp...> - 2012年09月04日 19:33:15
Isn't that what the unit system is for? It allows users to use whatever objects they want and register conversions to/from MPL types. If Decimal is a common use-case, then perhaps MPL should provide those converters but the user would (and probably should) still need to activate them.
________________________________________
From: Eric Firing [ef...@ha...]
Sent: Tuesday, September 04, 2012 12:24 PM
To: mat...@li...
Subject: Re: [Matplotlib-users] type error with python 3.2 and version 1.1.1 of matplotlib (numpy error)
On 2012年09月04日 9:09 AM, Benjamin Root wrote:
>
>
> On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay <pau...@gm...
> <mailto:pau...@gm...>> wrote:
>
>
> The following Python code:
>
> >>ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
>
> Produces this error with Python 3.2:
>
> Traceback (most recent call last):
> File "scripts/audit_reports_weekly.py", line 150, in <module>
> ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py",
> line 6741, in fill_between
> y1 = ma.masked_invalid(self.convert_yunits(y1))
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py",
> line 2241, in masked_invalid
> condition = ~(np.isfinite(a))
> TypeError: ufunc 'isfinite' not supported for the input types, and
> the inputs could not be safely coerced to any supported types
> according to the casting rule ''safe''
>
>
> [Decimal('3619.900530366609820157812617'), .....]
>
> If I change the list from type Decimal to type float, then I don't
> get the error. Likewise, if I use Python 2.7, I also don't get an error.
>
> After reading over the error message, I realize that this error
> really results because of numpy, not matplotlib. But I'll go ahead
> and post this message, in case you are unaware of the problem.
>
>
> Just a quick note, mpl v1.1.x is not officially supported for py3k. The
> upcoming release of v1.2.0 will be the first official release with such
> support.
>
> That being said, it probably would be a good idea to make sure where the
> bug lies for this one (numpy or matplotlib). Which version of numpy are
> you using?
Should this be considered a bug? Or should we say that we don't support
Decimal inputs? If we are going to support Decimal inputs, then we need
to put in filters to force conversion to float. Do you want to have to
check every entry in every list input to see if it Decimal?
Eric
>
> Ben Root
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On 2012年09月04日 9:09 AM, Benjamin Root wrote:
>
>
> On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay <pau...@gm...
> <mailto:pau...@gm...>> wrote:
>
>
> The following Python code:
>
> >>ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
>
> Produces this error with Python 3.2:
>
> Traceback (most recent call last):
> File "scripts/audit_reports_weekly.py", line 150, in <module>
> ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py",
> line 6741, in fill_between
> y1 = ma.masked_invalid(self.convert_yunits(y1))
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py",
> line 2241, in masked_invalid
> condition = ~(np.isfinite(a))
> TypeError: ufunc 'isfinite' not supported for the input types, and
> the inputs could not be safely coerced to any supported types
> according to the casting rule ''safe''
>
>
> [Decimal('3619.900530366609820157812617'), .....]
>
> If I change the list from type Decimal to type float, then I don't
> get the error. Likewise, if I use Python 2.7, I also don't get an error.
>
> After reading over the error message, I realize that this error
> really results because of numpy, not matplotlib. But I'll go ahead
> and post this message, in case you are unaware of the problem.
>
>
> Just a quick note, mpl v1.1.x is not officially supported for py3k. The
> upcoming release of v1.2.0 will be the first official release with such
> support.
>
> That being said, it probably would be a good idea to make sure where the
> bug lies for this one (numpy or matplotlib). Which version of numpy are
> you using?
To clarify my previous message: I think we will remain mostly at the 
mercy of numpy, which may change from version to version, to determine 
what we can handle. Apart from registered unit types, we fall back on 
numpy, typically masked_invalid, to handle inputs. If we really want to 
handle Decimal reliably, then it probably has to be done within the 
units framework.
Eric
>
> Ben Root
From: Benjamin R. <ben...@ou...> - 2012年09月04日 19:30:38
On Tue, Sep 4, 2012 at 3:24 PM, Eric Firing <ef...@ha...> wrote:
> On 2012年09月04日 9:09 AM, Benjamin Root wrote:
> >
> >
> > On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay <pau...@gm...
> > <mailto:pau...@gm...>> wrote:
> >
> >
> > The following Python code:
> >
> > >>ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
> >
> > Produces this error with Python 3.2:
> >
> > Traceback (most recent call last):
> > File "scripts/audit_reports_weekly.py", line 150, in <module>
> > ax.fill_between(dates, lower, upper, facecolor='gray',
> alpha=0.5)
> > File
> >
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py",
> > line 6741, in fill_between
> > y1 = ma.masked_invalid(self.convert_yunits(y1))
> > File
> >
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py",
> > line 2241, in masked_invalid
> > condition = ~(np.isfinite(a))
> > TypeError: ufunc 'isfinite' not supported for the input types, and
> > the inputs could not be safely coerced to any supported types
> > according to the casting rule ''safe''
> >
> >
> > [Decimal('3619.900530366609820157812617'), .....]
> >
> > If I change the list from type Decimal to type float, then I don't
> > get the error. Likewise, if I use Python 2.7, I also don't get an
> error.
> >
> > After reading over the error message, I realize that this error
> > really results because of numpy, not matplotlib. But I'll go ahead
> > and post this message, in case you are unaware of the problem.
> >
> >
> > Just a quick note, mpl v1.1.x is not officially supported for py3k. The
> > upcoming release of v1.2.0 will be the first official release with such
> > support.
> >
> > That being said, it probably would be a good idea to make sure where the
> > bug lies for this one (numpy or matplotlib). Which version of numpy are
> > you using?
>
> Should this be considered a bug? Or should we say that we don't support
> Decimal inputs? If we are going to support Decimal inputs, then we need
> to put in filters to force conversion to float. Do you want to have to
> check every entry in every list input to see if it Decimal?
>
> Eric
>
>
Looking at the message, it is saying that the np.isfinite() function fails
on Decimal inputs. From our perspective, a Decimal input should look just
the same as integer and floats (following the duck-typing paradigm).
Therefore, I think this problem lies squarely at the feet of numpy.
However, I am doubtful of just how quickly to expect this issue to be
solved by them.
Ben Root
On 2012年09月04日 9:09 AM, Benjamin Root wrote:
>
>
> On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay <pau...@gm...
> <mailto:pau...@gm...>> wrote:
>
>
> The following Python code:
>
> >>ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
>
> Produces this error with Python 3.2:
>
> Traceback (most recent call last):
> File "scripts/audit_reports_weekly.py", line 150, in <module>
> ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py",
> line 6741, in fill_between
> y1 = ma.masked_invalid(self.convert_yunits(y1))
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py",
> line 2241, in masked_invalid
> condition = ~(np.isfinite(a))
> TypeError: ufunc 'isfinite' not supported for the input types, and
> the inputs could not be safely coerced to any supported types
> according to the casting rule ''safe''
>
>
> [Decimal('3619.900530366609820157812617'), .....]
>
> If I change the list from type Decimal to type float, then I don't
> get the error. Likewise, if I use Python 2.7, I also don't get an error.
>
> After reading over the error message, I realize that this error
> really results because of numpy, not matplotlib. But I'll go ahead
> and post this message, in case you are unaware of the problem.
>
>
> Just a quick note, mpl v1.1.x is not officially supported for py3k. The
> upcoming release of v1.2.0 will be the first official release with such
> support.
>
> That being said, it probably would be a good idea to make sure where the
> bug lies for this one (numpy or matplotlib). Which version of numpy are
> you using?
Should this be considered a bug? Or should we say that we don't support 
Decimal inputs? If we are going to support Decimal inputs, then we need 
to put in filters to force conversion to float. Do you want to have to 
check every entry in every list input to see if it Decimal?
Eric
>
> Ben Root
From: Benjamin R. <ben...@ou...> - 2012年09月04日 19:09:38
On Tue, Sep 4, 2012 at 2:20 PM, Paul Tremblay <pau...@gm...>wrote:
>
> The following Python code:
>
> >>ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
>
> Produces this error with Python 3.2:
>
> Traceback (most recent call last):
> File "scripts/audit_reports_weekly.py", line 150, in <module>
> ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py",
> line 6741, in fill_between
> y1 = ma.masked_invalid(self.convert_yunits(y1))
> File
> "/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py",
> line 2241, in masked_invalid
> condition = ~(np.isfinite(a))
> TypeError: ufunc 'isfinite' not supported for the input types, and the
> inputs could not be safely coerced to any supported types according to the
> casting rule ''safe''
>
>
> [Decimal('3619.900530366609820157812617'), .....]
>
> If I change the list from type Decimal to type float, then I don't get the
> error. Likewise, if I use Python 2.7, I also don't get an error.
>
> After reading over the error message, I realize that this error really
> results because of numpy, not matplotlib. But I'll go ahead and post this
> message, in case you are unaware of the problem.
>
>
Just a quick note, mpl v1.1.x is not officially supported for py3k. The
upcoming release of v1.2.0 will be the first official release with such
support.
That being said, it probably would be a good idea to make sure where the
bug lies for this one (numpy or matplotlib). Which version of numpy are
you using?
Ben Root
The following Python code:
>>ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
Produces this error with Python 3.2:
Traceback (most recent call last):
 File "scripts/audit_reports_weekly.py", line 150, in <module>
 ax.fill_between(dates, lower, upper, facecolor='gray', alpha=0.5)
 File
"/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/matplotlib/axes.py",
line 6741, in fill_between
 y1 = ma.masked_invalid(self.convert_yunits(y1))
 File
"/home/local/ANT/ptrembl/.local/lib/python3.2/site-packages/numpy/ma/core.py",
line 2241, in masked_invalid
 condition = ~(np.isfinite(a))
TypeError: ufunc 'isfinite' not supported for the input types, and the
inputs could not be safely coerced to any supported types according to the
casting rule ''safe''
[Decimal('3619.900530366609820157812617'), .....]
If I change the list from type Decimal to type float, then I don't get the
error. Likewise, if I use Python 2.7, I also don't get an error.
After reading over the error message, I realize that this error really
results because of numpy, not matplotlib. But I'll go ahead and post this
message, in case you are unaware of the problem.
From: gyro f. <gyr...@gm...> - 2012年09月04日 17:53:39
On 2012年09月04日 10:53 AM, Benjamin Root wrote:
> 
> On Mon, Sep 3, 2012 at 4:26 PM, Gyro Funch <gyr...@gm...
> <mailto:gyr...@gm...>> wrote:
> 
> Hi,
> 
> I am trying to create a multi-subplot animation with based loosely
> on the animation example code, subplots.py, at
> http://matplotlib.sourceforge.net/examples/animation/subplots.html
> 
> A simplified version of the full code is shown at this gist:
> https://gist.github.com/3613113
> 
> I am having problems getting the code to function properly. If I run
> it as is, the figure appears, but no animation is done. Apparently
> the setup code is called, but the code to change the frames is not.
> If I comment out the call to the setup code, the method to update
> the frame is called once, and that is it.
> 
> I would appreciate any help and insights that you can provide.
> 
> Thank you very much.
> 
> -g
> 
> 
> 
> Confirmed. I do not see any immediate reason why your code doesn't
> work. I suggest filing an issue on our github site.
> 
> Ben Root
> 
Thanks for the feedback.
https://github.com/matplotlib/matplotlib/issues/1203
-g
From: Benjamin R. <ben...@ou...> - 2012年09月04日 16:54:04
On Mon, Sep 3, 2012 at 4:26 PM, Gyro Funch <gyr...@gm...> wrote:
> Hi,
>
> I am trying to create a multi-subplot animation with based loosely
> on the animation example code, subplots.py, at
> http://matplotlib.sourceforge.net/examples/animation/subplots.html
>
> A simplified version of the full code is shown at this gist:
> https://gist.github.com/3613113
>
> I am having problems getting the code to function properly. If I run
> it as is, the figure appears, but no animation is done. Apparently
> the setup code is called, but the code to change the frames is not.
> If I comment out the call to the setup code, the method to update
> the frame is called once, and that is it.
>
> I would appreciate any help and insights that you can provide.
>
> Thank you very much.
>
> -g
>
>
>
Confirmed. I do not see any immediate reason why your code doesn't work.
I suggest filing an issue on our github site.
Ben Root
From: Francesco M. <fra...@gm...> - 2012年09月04日 16:00:51
Dear Eric,
sorry for the delay in replying, and thanking: I forgot the mail after
reading it.
2012年8月30日 Eric Firing <ef...@ha...>:
> On 2012年08月27日 5:10 AM, Francesco Montesano wrote:
>> Dear matplotlibers,
>>
>> I encountered a bug (?) in fill_between when using logarithmic scales and
>> the last part of y and yerr arrays as set to zero: a diagonal stripe going from
>> the rightmost non zero value to the first value is drawn.
>> It's visible in the right panel of the attached figure, while is not
>> present if the plot is linear (left panel).
>> If xaxis is log and yaxis is linear the plot is correctly drawn.
>>
>> I'm using mpl.__version__ = '1.1.1rc' under Kubuntu 12.04 with Python 2.7.3
>>
>> The plot has been created with the script below.
>>
>> Is this a bug or am I missing something?
>
> I don't think it is exactly a bug, but I don't know why the fill region
> is appearing as it does. The underlying problem is that fill_between is
> doing what it is told to do without knowing that it is going to be
> plotted on a log axis.
I think that also most of the other plotting functions (e.g. errorbar)
do not know about the scale used on the axis, but they behave
correctly. Am I right?
> A good workaround is to change your call to fill_between to look like this:
> positive = y - yerr > 0
> ax2.fill_between( x,y-yerr,y+yerr, where=positive, color='b', alpha=0.4)
>
> Alternatively, you could use np.clip to put a floor under y - yerr and y
> + yerr.
The workaround works fine, but I dare say that it's not THE solution.
I think that the problem lies in the way PolyCollection is drawn when
y=yerr=0 (and probably also if y+- yerr <=0) if the yaxis is log. I
have no clue where to look in the source to go deeper in the problem.
cheers,
Fra
> Eric
>
>>
>> Cheers
>> Francesco
>>
>>
>> ##### error_fill_between.py ######
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> #values to plot
>> x = np.linspace( 1, 10, num=100 )
>> y = np.exp( -x**2 )
>> y[50:] = 0
>> yerr = y* np.random.rand(100)
>>
>> #figure
>> fig = plt.figure()
>>
>> ax1 = fig.add_subplot(121) #first axes: linear
>> ax1.errorbar( x,y,yerr, c='r' )
>> ax1.fill_between( x,y-yerr,y+yerr, color='b', alpha=0.4 )
>>
>> ax2 = fig.add_subplot(122) #second axes: logarithmic
>> ax2.errorbar( x,y,yerr, c='r' )
>> ax2.fill_between( x,y-yerr,y+yerr, color='b', alpha=0.4 )
>> ax2.set_xscale( "log" )
>> ax2.set_yscale( "log" )
>>
>> plt.show()
>> ###### end script #########
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2012年09月04日 07:49:53
On 2012年09月03日 9:36 PM, Jakob Gager wrote:
> On 09/04/2012 09:13 AM, Eric Firing wrote:
>> On 2012年09月03日 8:33 PM, Jakob Gager wrote:
>>> On 09/03/2012 08:57 PM, Eric Firing wrote:
>>>> It looks like you can either use the _get_layout() method (which
>>>> requires that you specify the renderer), or, if you know the text object
>>>> will be among the last 50 for which _get_layout() has been called, you
>>>> can use txt1.cached[txt1.get_prop_typ()].
>>>>
>>>> Eric
>>>
>>> Many thanks for the quick and valuable return. I now use the _get_layout() method and
>>> it works like a charm :)
>>>
>>> Just replaced:
>>> sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0]
>>> with:
>>> sf1 = 6*72./txt1._get_layout('GTKAgg')[1][0][1][0]
>>
>> Jakob,
>>
>> What is actually happening here is that the first two lines of
>> _get_layout() are equivalent to the second method I suggested (that's
>> where I got the idea for that method), and the renderer argument is
>> never being used. This is good, because the renderer argument would have
>> to be a renderer instance, not the string name of a backend.
>>
>> There is also the caution that the leading underscore means
>> _get_layout() is intended for internal mpl use only, and subject to
>> change without notice. So, with some future version of mpl, you may need
>> to change your code again.
>>
>> Eric
>>
> Hi Eric,
>
> does this mean you would suggest to use txt1.cached[txt1.get_prop_tup()] to be on the save side for
> future versions? I'm aware of the leading underscore notation, however, the txt.cached dictionary has
> changed as well (without leading underscore and notice?), therefore, slight modifications in the scrips
> cannot be precluded anyway.
You are right; although it lacks the underscore, I doubt the "cached" 
attribute and the "get_prop_tup()" method were intended for anything but 
internal use. There is no safe solution!
>
> Regarding the renderer argument...
> I first thought about passing a renderer instance to the _get_layout method, but as I had no clue where
> to get this instance from. So I simply tried with the backend name and luckly it worked :).
That's the advantage of the txt1.cached[] approach; it doesn't require 
you to supply a bogus but unused argument. It's probably what I would pick.
In any case, I'm glad you are back in business.
Eric
>
> Thanks again, and have a nice day!
> Jakob
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jakob G. <ga...@il...> - 2012年09月04日 07:37:16
On 09/04/2012 09:13 AM, Eric Firing wrote:
> On 2012年09月03日 8:33 PM, Jakob Gager wrote:
>> On 09/03/2012 08:57 PM, Eric Firing wrote:
>>> It looks like you can either use the _get_layout() method (which
>>> requires that you specify the renderer), or, if you know the text object
>>> will be among the last 50 for which _get_layout() has been called, you
>>> can use txt1.cached[txt1.get_prop_typ()].
>>>
>>> Eric
>>
>> Many thanks for the quick and valuable return. I now use the _get_layout() method and
>> it works like a charm :)
>>
>> Just replaced:
>> sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0]
>> with:
>> sf1 = 6*72./txt1._get_layout('GTKAgg')[1][0][1][0]
>
> Jakob,
>
> What is actually happening here is that the first two lines of
> _get_layout() are equivalent to the second method I suggested (that's
> where I got the idea for that method), and the renderer argument is
> never being used. This is good, because the renderer argument would have
> to be a renderer instance, not the string name of a backend.
>
> There is also the caution that the leading underscore means
> _get_layout() is intended for internal mpl use only, and subject to
> change without notice. So, with some future version of mpl, you may need
> to change your code again.
>
> Eric
>
Hi Eric,
does this mean you would suggest to use txt1.cached[txt1.get_prop_tup()] to be on the save side for 
future versions? I'm aware of the leading underscore notation, however, the txt.cached dictionary has 
changed as well (without leading underscore and notice?), therefore, slight modifications in the scrips
cannot be precluded anyway.
Regarding the renderer argument...
I first thought about passing a renderer instance to the _get_layout method, but as I had no clue where 
to get this instance from. So I simply tried with the backend name and luckly it worked :).
Thanks again, and have a nice day!
Jakob
From: Eric F. <ef...@ha...> - 2012年09月04日 07:13:38
On 2012年09月03日 8:33 PM, Jakob Gager wrote:
> On 09/03/2012 08:57 PM, Eric Firing wrote:
>> It looks like you can either use the _get_layout() method (which
>> requires that you specify the renderer), or, if you know the text object
>> will be among the last 50 for which _get_layout() has been called, you
>> can use txt1.cached[txt1.get_prop_typ()].
>>
>>>
>>> Is there a different way to achieve a fitted text object?
>>
>> Not that I know of; but someone else may have a suggestion.
>>
>> Eric
>
> Many thanks for the quick and valuable return. I now use the _get_layout() method and
> it works like a charm :)
>
> Just replaced:
> sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0]
> with:
> sf1 = 6*72./txt1._get_layout('GTKAgg')[1][0][1][0]
Jakob,
What is actually happening here is that the first two lines of 
_get_layout() are equivalent to the second method I suggested (that's 
where I got the idea for that method), and the renderer argument is 
never being used. This is good, because the renderer argument would have 
to be a renderer instance, not the string name of a backend.
There is also the caution that the leading underscore means 
_get_layout() is intended for internal mpl use only, and subject to 
change without notice. So, with some future version of mpl, you may need 
to change your code again.
Eric
>
> br
> Jakob
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jakob G. <ga...@il...> - 2012年09月04日 06:33:32
On 09/03/2012 08:57 PM, Eric Firing wrote:
> It looks like you can either use the _get_layout() method (which
> requires that you specify the renderer), or, if you know the text object
> will be among the last 50 for which _get_layout() has been called, you
> can use txt1.cached[txt1.get_prop_typ()].
>
>>
>> Is there a different way to achieve a fitted text object?
>
> Not that I know of; but someone else may have a suggestion.
>
> Eric
Many thanks for the quick and valuable return. I now use the _get_layout() method and
it works like a charm :)
Just replaced:
sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0]
with:
sf1 = 6*72./txt1._get_layout('GTKAgg')[1][0][1][0]
br
Jakob
From: Damon M. <dam...@gm...> - 2012年09月03日 22:15:32
On Mon, Sep 3, 2012 at 10:20 PM, Chao YUE <cha...@gm...> wrote:
> Thanks Damon, it's very clear now.
> I explicit set the backend as "GTKAgg" in my ipython user configuration
> file. and always set the backend to 'Agg' in my rc file. So that when I use
> ipython, I can see the window interactively, but when I use script, it also
> works :P
>
That's an awesome idea.
Glad it's working now.
> Chao
>
>
> On Mon, Sep 3, 2012 at 8:13 PM, Damon McDougall <dam...@gm...>
> wrote:
>>
>> On Mon, Sep 3, 2012 at 6:08 PM, Chao YUE <cha...@gm...> wrote:
>> > Yet if I don't want to change the rc file, I guess I must change in the
>> > modules where matplotlib has been imported for the first time?
>>
>> If you're changing the rc file in your home directory:
>>
>> ~/.matplotlib/matplotlibrc
>>
>> then just make a copy before you change it:
>>
>> cd ~/.matplotlib
>> cp matplotlibrc matplotlibrc_orig
>>
>> then edit matplotlibrc. Just rename matplotlibrc_orig back to
>> matplotlibrc when you're done.
>>
>> --
>> Damon McDougall
>> http://www.damon.is-a-geek.com
>> B2.39
>> Mathematics Institute
>> University of Warwick
>> Coventry
>> West Midlands
>> CV4 7AL
>> United Kingdom
>
>
>
>
> --
> ***********************************************************************************
> 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
> ************************************************************************************
>
-- 
Damon McDougall
http://www.damon.is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Chao Y. <cha...@gm...> - 2012年09月03日 21:20:30
Thanks Damon, it's very clear now.
I explicit set the backend as "GTKAgg" in my ipython user configuration
file. and always set the backend to 'Agg' in my rc file. So that when I use
ipython, I can see the window interactively, but when I use script, it also
works :P
Chao
On Mon, Sep 3, 2012 at 8:13 PM, Damon McDougall
<dam...@gm...>wrote:
> On Mon, Sep 3, 2012 at 6:08 PM, Chao YUE <cha...@gm...> wrote:
> > Yet if I don't want to change the rc file, I guess I must change in the
> > modules where matplotlib has been imported for the first time?
>
> If you're changing the rc file in your home directory:
>
> ~/.matplotlib/matplotlibrc
>
> then just make a copy before you change it:
>
> cd ~/.matplotlib
> cp matplotlibrc matplotlibrc_orig
>
> then edit matplotlibrc. Just rename matplotlibrc_orig back to
> matplotlibrc when you're done.
>
> --
> Damon McDougall
> http://www.damon.is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
>
-- 
***********************************************************************************
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: Gyro F. <gyr...@gm...> - 2012年09月03日 20:30:09
Hi,
I am trying to create a multi-subplot animation with based loosely
on the animation example code, subplots.py, at
http://matplotlib.sourceforge.net/examples/animation/subplots.html
A simplified version of the full code is shown at this gist:
https://gist.github.com/3613113
I am having problems getting the code to function properly. If I run
it as is, the figure appears, but no animation is done. Apparently
the setup code is called, but the code to change the frames is not.
If I comment out the call to the setup code, the method to update
the frame is called once, and that is it.
I would appreciate any help and insights that you can provide.
Thank you very much.
-g
From: Eric F. <ef...@ha...> - 2012年09月03日 18:57:38
On 2012年09月03日 1:38 AM, Jakob Gager wrote:
> Recently, I switched from matplotlib 0.99 to 1.0.1 and unfortunately discovered
> that my text scaling script stopped working properly. The script scales the given text
> to fit into the current figure.
>
> A quick example of what I'm doing (works in 0.99, but not in 1.0.1 and 1.1.1rc):
> import matplotlib.pyplot as plt
> plt.ion()
> fig = plt.figure(1, (6,8), dpi=72)
> fig.add_axes([0,0,1,1])
> txt1 = plt.text(0.5,0.5,'foobar',horizontalalignment='center',verticalalignment='center')
> plt.draw()
> # compute width of figure in points and divide by txt1 bounding box width
> sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0]
> txt1.set_size(txt1.get_size()*sf1)
> plt.draw()
>
> The problem is related to the fact that starting from mpl 1.0.1, the txt1.cached dictionary contains
> information of all text objects present rather than only of the specific object.
> I guess this behavior is intended, however this way it is rather complicated to derive the bounding
> box of the specific text object without cycling over the whole dictionary.
It looks like you can either use the _get_layout() method (which 
requires that you specify the renderer), or, if you know the text object 
will be among the last 50 for which _get_layout() has been called, you 
can use txt1.cached[txt1.get_prop_typ()].
>
> Is there a different way to achieve a fitted text object?
Not that I know of; but someone else may have a suggestion.
Eric
>
> Thanks,
> br Jakob
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Damon M. <dam...@gm...> - 2012年09月03日 18:13:27
On Mon, Sep 3, 2012 at 6:08 PM, Chao YUE <cha...@gm...> wrote:
> Yet if I don't want to change the rc file, I guess I must change in the
> modules where matplotlib has been imported for the first time?
If you're changing the rc file in your home directory:
~/.matplotlib/matplotlibrc
then just make a copy before you change it:
cd ~/.matplotlib
cp matplotlibrc matplotlibrc_orig
then edit matplotlibrc. Just rename matplotlibrc_orig back to
matplotlibrc when you're done.
-- 
Damon McDougall
http://www.damon.is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Chao Y. <cha...@gm...> - 2012年09月03日 17:08:45
Hi Ben,
I changed the backend in matplotlibrc file. It works fine. Yet if I don't
want to change the rc file, I guess I must change in the modules where
matplotlib has been imported for the first time?
cheers,
Chao
On Mon, Sep 3, 2012 at 3:30 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> On Monday, September 3, 2012, Chao YUE wrote:
>
>> Dear all,
>>
>> I have a module written by myself which use
>> python-netcdf/matplotlib/numpy/basemap for treating and mapping of netcdf
>> files.
>> so in the module I have a line:
>>
>> import matplotlib.pyplot as plt
>>
>> But now I am using some function of this module which do not involve the
>> visualisation. And I want to use it in a batch mode submitted by qsub
>> command.
>> And then I have traceback like following:
>>
>> File "/home/orchidee01/ychao/SCRIPT/combine.py", line 1, in <module>
>> import gnc
>> File "/home/users/ychao/python/python_lib/gnc.py", line 4, in <module>
>> import matplotlib.pyplot as plt
>> File
>> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/pyplot.py",
>> line 95, in <module>
>> new_figure_manager, draw_if_interactive, _show = pylab_setup()
>> File
>> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/__init__.py",
>> line 25, in pylab_setup
>> globals(),locals(),[backend_name])
>> File
>> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py",
>> line 10, in <module>
>> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
>> FigureCanvasGTK,\
>> File
>> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py",
>> line 8, in <module>
>> import gtk; gdk = gtk.gdk
>> File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
>> 64, in <module>
>> _init()
>> File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
>> 52, in _init
>> _gtk.init_check()
>> RuntimeError: could not open display
>>
>> From the last line, I think this is because I cannot use this module in a
>> non-interactive mode. So is there a way I can bypass this issue and still
>> use the module in a non-interactive mode? Thanks a lot for any
>> information.
>>
>> Chao
>>
>>
> import matplotlib
> matplotlib.use("AGG")
>
> Or set that in the matplotlibrc file.
>
> Cheers,
> Ben Root
>
-- 
***********************************************************************************
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: Alan G I. <ai...@am...> - 2012年09月03日 14:32:00
On 8/29/2012 10:32 PM, Fernando Perez wrote:
> http://numfocus.org/johnhunter
My thanks to NumFOCUS for setting up this
memorial fund so that Matplotlib users
can say thank you to John.
Alan Isaac
From: Benjamin R. <ben...@ou...> - 2012年09月03日 13:30:31
On Monday, September 3, 2012, Chao YUE wrote:
> Dear all,
>
> I have a module written by myself which use
> python-netcdf/matplotlib/numpy/basemap for treating and mapping of netcdf
> files.
> so in the module I have a line:
>
> import matplotlib.pyplot as plt
>
> But now I am using some function of this module which do not involve the
> visualisation. And I want to use it in a batch mode submitted by qsub
> command.
> And then I have traceback like following:
>
> File "/home/orchidee01/ychao/SCRIPT/combine.py", line 1, in <module>
> import gnc
> File "/home/users/ychao/python/python_lib/gnc.py", line 4, in <module>
> import matplotlib.pyplot as plt
> File
> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/pyplot.py",
> line 95, in <module>
> new_figure_manager, draw_if_interactive, _show = pylab_setup()
> File
> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/__init__.py",
> line 25, in pylab_setup
> globals(),locals(),[backend_name])
> File
> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py",
> line 10, in <module>
> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
> FigureCanvasGTK,\
> File
> "/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py",
> line 8, in <module>
> import gtk; gdk = gtk.gdk
> File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
> 64, in <module>
> _init()
> File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
> 52, in _init
> _gtk.init_check()
> RuntimeError: could not open display
>
> From the last line, I think this is because I cannot use this module in a
> non-interactive mode. So is there a way I can bypass this issue and still
> use the module in a non-interactive mode? Thanks a lot for any
> information.
>
> Chao
>
>
import matplotlib
matplotlib.use("AGG")
Or set that in the matplotlibrc file.
Cheers,
Ben Root
From: Chao Y. <cha...@gm...> - 2012年09月03日 12:53:55
Dear all,
I have a module written by myself which use
python-netcdf/matplotlib/numpy/basemap for treating and mapping of netcdf
files.
so in the module I have a line:
import matplotlib.pyplot as plt
But now I am using some function of this module which do not involve the
visualisation. And I want to use it in a batch mode submitted by qsub
command.
And then I have traceback like following:
 File "/home/orchidee01/ychao/SCRIPT/combine.py", line 1, in <module>
 import gnc
 File "/home/users/ychao/python/python_lib/gnc.py", line 4, in <module>
 import matplotlib.pyplot as plt
 File
"/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/pyplot.py",
line 95, in <module>
 new_figure_manager, draw_if_interactive, _show = pylab_setup()
 File
"/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/__init__.py",
line 25, in pylab_setup
 globals(),locals(),[backend_name])
 File
"/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py",
line 10, in <module>
 from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
FigureCanvasGTK,\
 File
"/usr/local/install/matplotlib-1.1.0/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py",
line 8, in <module>
 import gtk; gdk = gtk.gdk
 File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
64, in <module>
 _init()
 File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
52, in _init
 _gtk.init_check()
RuntimeError: could not open display
>From the last line, I think this is because I cannot use this module in a
non-interactive mode. So is there a way I can bypass this issue and still
use the module in a non-interactive mode? Thanks a lot for any information.
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: Jakob G. <ga...@il...> - 2012年09月03日 11:56:08
Recently, I switched from matplotlib 0.99 to 1.0.1 and unfortunately discovered
that my text scaling script stopped working properly. The script scales the given text
to fit into the current figure.
A quick example of what I'm doing (works in 0.99, but not in 1.0.1 and 1.1.1rc):
import matplotlib.pyplot as plt
plt.ion()
fig = plt.figure(1, (6,8), dpi=72)
fig.add_axes([0,0,1,1])
txt1 = plt.text(0.5,0.5,'foobar',horizontalalignment='center',verticalalignment='center')
plt.draw()
# compute width of figure in points and divide by txt1 bounding box width
sf1 = 6*72./txt1.cached.items()[0][1][1][0][1][0]
txt1.set_size(txt1.get_size()*sf1)
plt.draw()
The problem is related to the fact that starting from mpl 1.0.1, the txt1.cached dictionary contains 
information of all text objects present rather than only of the specific object.
I guess this behavior is intended, however this way it is rather complicated to derive the bounding
box of the specific text object without cycling over the whole dictionary.
Is there a different way to achieve a fitted text object?
Thanks,
br Jakob

Showing results of 276

<< < 1 .. 9 10 11 12 > >> (Page 11 of 12)
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 によって変換されたページ (->オリジナル) /