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






Showing results of 362

<< < 1 2 3 4 5 .. 15 > >> (Page 3 of 15)
From: Cohen-Tanugi J. <Joh...@lp...> - 2008年11月25日 09:23:16
indeed it works with python now, provided I uncomment the wxAgg setting 
in the script.
best,
Johann
Eric Bruning wrote:
> Strange, strange. iPython is apparently having some effect here: I tried
> ipython -pylab animation.py
> and I got a figure with the initial plot, but nothing further
> happened. After closing the plot, I typed
> run animation.py
> at the ipython prompt, and saw the initial plot, erasure, and
> animation that I expected. Can you try running with a plain
> python animation.py
>
> I've attached a new version of the script with some changes suggested
> offline by Ryan May - he was seeing platform or wx-specific behavior
> related to event handling. All bugs remaining are mine :)
>
> -Eric
>
> On Sun, Nov 23, 2008 at 6:20 PM, Cohen-Tanugi Johann
> <co...@lp...> wrote:
> 
>>> hi, I tried your script, commenting/uncommenting the backend line, but I
>>> still get:
>>> [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py
>>>
>>> ---------------------------------------------------------------------------
>>> AttributeError Traceback (most recent call
>>> last)
>>>
>>> /home/cohen/MACROS/animation.py in <module>()
>>> 274 p.show()
>>> 275
>>> --> 276 t = test()
>>> 277
>>> 278
>>>
>>> /home/cohen/MACROS/animation.py in __init__(self)
>>> 270
>>> 271 # cid = p.gcf().canvas.mpl_connect('idle_event',
>>> self.update)
>>> --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update)
>>> 273
>>> 274 p.show()
>>>
>>> AttributeError: 'NoneType' object has no attribute 'Bind'
>>> WARNING: Failure executing file: <MACROS/animation.py>
>>>
>>> I am using MPL revision 6440.
>>> cheers,
>>> Johann
>>>
>>> Eric Bruning wrote:
>>> 
>>>> Hi Eric,
>>>>
>>>> 
>>>>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote:
>>>>>
>>>>> 
>>>>>> I've looked through the latest examples as well as google and the list
>>>>>> archives, and am still at a loss -- can anyone point me to an example
>>>>>> of
>>>>>> how to animate a scatter plot?
>>>>>>
>>>>>> 
>>>> I've attached a somewhat unpolished but functional example that shows
>>>> time-synchronized animation of multiple scatter plots. It uses the wx
>>>> backend explicitly, due to some issues with the idle event handling.
>>>>
>>>>
>>>> 
>>>>>> The collection returned by scatter() lacks anything akin to a set_data
>>>>>> method.
>>>>>>
>>>>>> 
>>>> Yup, you want this instead:
>>>> collection.set_offsets(xy)
>>>> collection.set_array(s)
>>>>
>>>> -Eric
>>>> ------------------------------------------------------------------------
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>>> challenge
>>>> Build the coolest Linux based applications with Moblin SDK & win great
>>>> prizes
>>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>>> world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>> 
From: Zane S. <za...@id...> - 2008年11月25日 04:52:49
> We have two modes to render latex -- one is native TeX layout and uses
> latex and dvipng, and is superior if you need all of TeX's
> capabilities (eg an eqnarray), but the fonts are suboptimal. The
> other is mathtext, which will cover 98% of most users' math needs,
> does not require a latex install because it is pure mpl, and uses
> nicer fonts .
Well, if I turn off usetex, then the LaTeX symbols don't get rendered 
correctly. It's obviously trying to do something other than just 
write out the plain text, but it's not doing the right thing. I quit 
out of matplotlib, and re-purged all the cached stuff from 
my .matplotlib directory, and it's still failing. From the docs, it 
sounds like mathtext is just the default way for Text objects to get 
rendered. It fails the same way irrespective of whether I use a raw 
string, or a double-quoted string:
fit_ax.set_ylabel(r'$\delta_{rms}$ [degrees]')
fit_ax.set_ylabel("$\delta_{rms}$ [degrees]")
both give a capital 'C' with a subscript 'rms'
$\bar{D}$ results in a capital D with a little circle over it.
20ドル^\circ$ yields 20 raised to the little tiny 'e' power.
Even if I wipe my site-packages/matplotlib* directory and egg-info, 
make clean, and recompile and install matplotlib from the SVN source, 
I still get the same problem. I don't know if it means anything, but 
I note that the mpl-data/fonts directory in SVN has 282 sub-entries, 
and the mpl-data/fonts directory that's getting installed in my site- 
packages only has 99 sub-entries. But maybe they aren't supposed to 
be the same? Dunno.
So for now I can only get my math symbols to render with text.usetext 
turned on.
I'll read up on the text formatters. Thanks for all your help!
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: John H. <jd...@gm...> - 2008年11月25日 04:10:59
On Mon, Nov 24, 2008 at 8:37 PM, Zane Selvans <za...@id...> wrote:
>
> On Nov 24, 2008, at 5:23 PM, John Hunter wrote:
>
> The first thing I noticed is that all of the LaTeX symbols I have in my
>
> plots are now messed up. I could see this being a font issue... does anyone
>
> I suggest completely wiping your .matplotlib directory (saving only
>
> your matplotlibrc if you have customized it). matplotlib caches a
>
> Thanks, this fixed it!
> Though, futzing with the LaTeX settings in the new matplotlibrc it appears
> that something about how/when it chooses when to format as tex has changed.
> If text.usetex is True, text in my labels and titles that is enclosed
> within $$'s gets typeset as tex, but apparently *all* of the xtick labels
> get set as mathtext - they're in the light/thin and slightly more difficult
> to read LaTeX font, and in my Basemap figures, the NSEW modifiers on the
> text objects indicating lat/lon direction are all italicised, as they would
> be were they enclosed in $$'s. I don't seem to be able to get the
> relatively bold, sans-serif tick labels, while still preserving the ability
> to typeset math in my labels and titles...
We have two modes to render latex -- one is native TeX layout and uses
latex and dvipng, and is superior if you need all of TeX's
capabilities (eg an eqnarray), but the fonts are suboptimal. The
other is mathtext, which will cover 98% of most users' math needs,
does not require a latex install because it is pure mpl, and uses
nicer fonts . The docs are here:
 mathtext: http://matplotlib.sourceforge.net/users/mathtext.html
 usetex: http://matplotlib.sourceforge.net/users/usetex.html
I strongly encourage using mathtext over usetex, unless you need some
of the hairy stuff from TeX.
> (An aside: how does one go about decorating the Text objects that label the
> ticks? I frequently have an axis whose units are degrees, and I'd rather
> just be able to append a $^\circ$ on the end of the text for the ticks,
> rather than have to say in the axis label [degrees].)
Use a custom formatter. I'm freestyling here, so check the examples
linked to below
 import matplotlib.ticker as ticker
 formatter = ticker.FormatStrFormatter(r'$%1.2f^\circ$')
 ax.xaxis.set_major_formatter(formatter)
The API docs for the tick formatting and locating are here
 http://matplotlib.sourceforge.net/api/ticker_api.html
And code examples matching "formatter" are here
 http://matplotlib.sourceforge.net/search.html?q=codex+formatter
> If I set text.markup to 'tex', instead of 'plain' I get a complaint about it
> being invalid, with a pointer to a URL that no longer exists to obtain a new
> matplotlibrc:
> Bad key "text.markup" on line 162 in /Users/zane/.matplotlib/matplotlibrc.
> You probably need to get an updated matplotlibrc file
> from http://matplotlib.sf.net/matplotlibrc or from the matplotlib
> source distribution
I've updated the code in svn to point to the new location
 http://matplotlib.sourceforge.net/_static/matplotlibrc
See also http://matplotlib.sourceforge.net/users/customizing.html
JDH
From: Zane S. <za...@id...> - 2008年11月25日 02:38:14
On Nov 24, 2008, at 5:23 PM, John Hunter wrote:
>> The first thing I noticed is that all of the LaTeX symbols I have 
>> in my
>> plots are now messed up. I could see this being a font issue... 
>> does anyone
> I suggest completely wiping your .matplotlib directory (saving only
> your matplotlibrc if you have customized it). matplotlib caches a
Thanks, this fixed it!
Though, futzing with the LaTeX settings in the new matplotlibrc it 
appears that something about how/when it chooses when to format as tex 
has changed. If text.usetex is True, text in my labels and titles 
that is enclosed within $$'s gets typeset as tex, but apparently *all* 
of the xtick labels get set as mathtext - they're in the light/thin 
and slightly more difficult to read LaTeX font, and in my Basemap 
figures, the NSEW modifiers on the text objects indicating lat/lon 
direction are all italicised, as they would be were they enclosed in $ 
$'s. I don't seem to be able to get the relatively bold, sans-serif 
tick labels, while still preserving the ability to typeset math in my 
labels and titles...
(An aside: how does one go about decorating the Text objects that 
label the ticks? I frequently have an axis whose units are degrees, 
and I'd rather just be able to append a $^\circ$ on the end of the 
text for the ticks, rather than have to say in the axis label 
[degrees].)
If I set text.markup to 'tex', instead of 'plain' I get a complaint 
about it being invalid, with a pointer to a URL that no longer exists 
to obtain a new matplotlibrc:
Bad key "text.markup" on line 162 in /Users/zane/.matplotlib/ 
matplotlibrc.
You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/matplotlibrc 
 or from the matplotlib source distribution
Thanks again!
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Eric B. <eri...@gm...> - 2008年11月25日 01:44:28
Attachments: animation.py
Strange, strange. iPython is apparently having some effect here: I tried
ipython -pylab animation.py
and I got a figure with the initial plot, but nothing further
happened. After closing the plot, I typed
run animation.py
at the ipython prompt, and saw the initial plot, erasure, and
animation that I expected. Can you try running with a plain
python animation.py
I've attached a new version of the script with some changes suggested
offline by Ryan May - he was seeing platform or wx-specific behavior
related to event handling. All bugs remaining are mine :)
-Eric
On Sun, Nov 23, 2008 at 6:20 PM, Cohen-Tanugi Johann
<co...@lp...> wrote:
>
>> hi, I tried your script, commenting/uncommenting the backend line, but I
>> still get:
>> [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py
>>
>> ---------------------------------------------------------------------------
>> AttributeError Traceback (most recent call
>> last)
>>
>> /home/cohen/MACROS/animation.py in <module>()
>> 274 p.show()
>> 275
>> --> 276 t = test()
>> 277
>> 278
>>
>> /home/cohen/MACROS/animation.py in __init__(self)
>> 270
>> 271 # cid = p.gcf().canvas.mpl_connect('idle_event',
>> self.update)
>> --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update)
>> 273
>> 274 p.show()
>>
>> AttributeError: 'NoneType' object has no attribute 'Bind'
>> WARNING: Failure executing file: <MACROS/animation.py>
>>
>> I am using MPL revision 6440.
>> cheers,
>> Johann
>>
>> Eric Bruning wrote:
>>>
>>> Hi Eric,
>>>
>>>>
>>>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote:
>>>>
>>>>>
>>>>> I've looked through the latest examples as well as google and the list
>>>>> archives, and am still at a loss -- can anyone point me to an example
>>>>> of
>>>>> how to animate a scatter plot?
>>>>>
>>>
>>> I've attached a somewhat unpolished but functional example that shows
>>> time-synchronized animation of multiple scatter plots. It uses the wx
>>> backend explicitly, due to some issues with the idle event handling.
>>>
>>>
>>>>>
>>>>> The collection returned by scatter() lacks anything akin to a set_data
>>>>> method.
>>>>>
>>>
>>> Yup, you want this instead:
>>> collection.set_offsets(xy)
>>> collection.set_array(s)
>>>
>>> -Eric
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
From: John H. <jd...@gm...> - 2008年11月25日 01:23:50
On Mon, Nov 24, 2008 at 6:23 PM, Zane Selvans <za...@id...> wrote:
> whether it's just the fact that I'm using the SVN code.
> The first thing I noticed is that all of the LaTeX symbols I have in my
> plots are now messed up. I could see this being a font issue... does anyone
> know how/where Matplotlib gets pointed at the LaTeX fonts? And how I would
> check to see where it's looking, or whether it's not finding what it's
> looking for? I'm not getting any errors - my greek letters just cease to be
> greek, and various text decorations (like \bar{D}) come out as other things
> altogether (like D, only with an Angstrom symbol over it...).
I suggest completely wiping your .matplotlib directory (saving only
your matplotlibrc if you have customized it). matplotlib caches a
fair amount of font and latex rendering stuff. I had a similar
problem on an upgrade with mathtext. We are not sure why it is
happening yet, but it will probably go away if you rm -rf
~/.matplotlib. Also, wipe your site-packages/matplotlib dir before
installing. See
 http://matplotlib.sourceforge.net/faq/installing_faq.html#cleanly-rebuild-and-reinstall-everything
To get more verbose information about what mpl is doing behind the
scense, run with
 > python myscript.py --verbose-debug
You can use --verbose-helpful for less output.
I think it might be a good idea for us to start using a versioned dir
structure for the cached data...
JDH
From: Eric F. <ef...@ha...> - 2008年11月25日 00:48:13
Zane Selvans wrote:
> Yesterday I compiled Matplotlib from SVN, and installed it to run on top 
[...]
> 
> The second thing is that in a figure in which I'm using twinx() to 
> create a separate y-axis using the same x-axis, I no longer seem to be 
> able to control the limits of the new axes. They just automatically 
> re-scale to fit whatever data is being plotted, regardless of whether I 
> use ax.set_ylim().
Formerly, autoscaling was not supported by shared axes, which would have 
included twinx. Now autoscaling is supported. I suspect this is the 
difference you are seeing. The solution is to turn off autoscaling with 
the ax.set_autoscale_on method, or to call ax.set_ylim after you have 
plotted your lines.
Eric
From: Zane S. <za...@id...> - 2008年11月25日 00:24:11
Yesterday I compiled Matplotlib from SVN, and installed it to run on 
top of the dependencies that I have installed from the SciPy Superpack 
for OS X from Chris Fonnesbeck. Nearly everything seems to be working 
fine. However, there are a couple of glitches, and I can't tell 
whether it's because of something being out of sync between all my 
installed bits, or whether it's just the fact that I'm using the SVN 
code.
The first thing I noticed is that all of the LaTeX symbols I have in 
my plots are now messed up. I could see this being a font issue... 
does anyone know how/where Matplotlib gets pointed at the LaTeX 
fonts? And how I would check to see where it's looking, or whether 
it's not finding what it's looking for? I'm not getting any errors - 
my greek letters just cease to be greek, and various text decorations 
(like \bar{D}) come out as other things altogether (like D, only with 
an Angstrom symbol over it...).
The second thing is that in a figure in which I'm using twinx() to 
create a separate y-axis using the same x-axis, I no longer seem to be 
able to control the limits of the new axes. They just automatically 
re-scale to fit whatever data is being plotted, regardless of whether 
I use ax.set_ylim().
Third, and this was a problem before I did the re-compile, and it 
remains so, often (but not always) my figures refuse to draw 
completely, until I've re-sized the window in which they're being 
displayed. This happens even when I do a figure.show() at the end of 
the script. Some of the lines will draw, but not all of them. Is 
this a familiar problem?
Thanks for any suggestions...
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: McBuell <c.s...@pa...> - 2008年11月24日 23:19:23
hi folks !
I'm working now quite a while with the matplotlib, also in the animated case
of plot_date and imshow charts.
Now I should use a vertical line (fixed to a plot_date plot, not to the
axis!) 
and I thought about using vlines as before.
But I have troubles to use the set_array method after the vlines are
created.
Does anybody know the exact array shape and content ?
After I pass any possible combination to the set_array method, the
esablished lines turn gray (from green like they were construgted). They
also don't change the location as desired (they stay fix)
It isn't a problem of canvas redrawing, also autoscale() doesn't help (as it
helped me with animated imshow).
Does anyone have experiance with animated vlines ? eg a working code example
?
Thank you in advance, 
Cheers
-- 
View this message in context: http://www.nabble.com/vlines-animation-problem-tp20672134p20672134.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2008年11月24日 13:07:15
Can you be more specific about what you would like to know? I'm happy 
to help.
Mike
Ron Brennan wrote:
> Hello,
>
> Does anyone know where I can find some histogram examples. The ones 
> with the documentation are not as self-explanatory as I would have liked.
>
> I'm not a mathematician and I am struggling to understand the math 
> behind the magic.
>
> Can anyone help?
>
> Thanks,
> Ron
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jae-Joon L. <lee...@gm...> - 2008年11月24日 06:01:48
>
> What if I wanted one legend with both entries in it, rather than two
> separate legends with a different entry in each? Is that possible? That's
> more desirable than two separate legends.
>
Check
http://www.nabble.com/displaying-a-legend-from-a-different-subplot-td18447966.html#a18447966
The legend() function lets you explicitly set what items you want to
show, regardless which axes they are from.
-JJ
From: Alan J. <al...@aj...> - 2008年11月24日 02:46:43
On 2008年11月23日 16:48:59 -0800
Zane Selvans <za...@id...> wrote:
> Incidentally, when you do it with ax.plot() instead you can see more 
> easily that the corners where the two sinusoidal functions intersect 
> are getting kind of chopped off by the polygon filling. Don't know if 
> there's an easy way to fix that - maybe by forcing the list of polygon 
> vertices to always explicitly include the points of intersection 
> between the functions being filled_between? Or maybe just by 
> increasing the number of vertices, though I assume that would slow 
> things down.
Some time back, I wrote code to generate a fairly complex polyfill in
a plot in R, 
http://www.oplnk.net/~ajackson/weather/Temperature_2000.png
The key bit of code to find the intersections between all the curves
to fill the corners correctly is here (note that this is "R" code):
intersect <- function(a, b, c, d) {
 # test two line segments for intersection.
 # modified from segseg in "Computational Geometry in C" 
 # by Joseph O'Rourke
 p = c(0,0)
 denom = a[1] * ( d[2] - c[2] ) +
 b[1] * ( c[2] - d[2] ) +
 d[1] * ( b[2] - a[2] ) +
 c[1] * ( a[2] - b[2] );
 # If denom is zero, then segments are parallel: handle separately. 
 if (abs(denom) <= 1.0e-10) {
 return (c(p,0)) 
 }
 num = a[1] * ( d[2] - c[2] ) +
 c[1] * ( a[2] - d[2] ) +
 d[1] * ( c[2] - a[2] );
 if ( (num == 0.0) || (num == denom) ) code = 0;
 s = num / denom;
 num = -( a[1] * ( c[2] - b[2] ) +
 b[1] * ( a[2] - c[2] ) +
 c[1] * ( b[2] - a[2] ) );
 if ( (num == 0.0) || (num == denom) ) code = 0;
 t = num / denom;
 if ( (0.0 < s) && (s < 1.0) &&
 (0.0 < t) && (t < 1.0) ) {
 code = 1;
 }
 else if ( (0.0 > s) || (s > 1.0) ||
 (0.0 > t) || (t > 1.0) ) {
 code = 0;
 }
 p[1] = a[1] + s * ( b[1] - a[1] );
 p[2] = a[2] + s * ( b[2] - a[2] );
 c(p,code);
}
# Intersect two lines defined by a series of segments. Assume the
# lines have common x-values and differ only in y
# intersect is array of (x,y) values
intersect.lines <- function (y1,y2,x) {
 intersect = array(data = NA, dim = c(2,0), dimnames = NULL)
 for (i in 2:length(x)) {
 a = c(x[i-1], y1[i-1])
 b = c(x[i], y1[i])
 c = c(x[i-1], y2[i-1])
 d = c(x[i], y2[i])
 foo = intersect(a,b,c,d)
 if (foo[3]) {
 intersect = cbind(intersect, foo[1:2])
 }
 }
 intersect
}
-- 
-----------------------------------------------------------------------
| Alan K. Jackson | To see a World in a Grain of Sand |
| al...@aj... | And a Heaven in a Wild Flower, |
| www.ajackson.org | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake |
-----------------------------------------------------------------------
From: John O. <joh...@ya...> - 2008年11月24日 02:46:05
Jeff Whitaker wrote:
> 
> Jeremy Conlin wrote:
>>
>>
>> Thanks for that information, that is what I needed. But now I come up 
>> with a separate problem. I have the following in my code:
>>
>> pylab.plot(n, S, 'b.', label='x')
>> pylab.legend()
>> ax2 = pylab.twinx()
>> pylab.plot(n, mean, 'r',label="mean")
>> ax2.yaxis.tick_right()
>> pylab.legend()
>>
>> Both plots are shown with the appropriate axes, but only the second 
>> plot is listed in the legend. If I only have the first, then only the 
>> first plot will be listed. Please help.
>>
>> Jeremy 
> Jeremy: The problem is that the legends are plotting on top of each 
> other. Try using 'loc=1' for the first one and 'loc=2' for the second
> one.
> 
What if I wanted one legend with both entries in it, rather than two
separate legends with a different entry in each? Is that possible? That's
more desirable than two separate legends.
JDO
-- 
View this message in context: http://www.nabble.com/Two-questions-regarding-axis-scaling-tp19463338p20654006.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Zane S. <za...@id...> - 2008年11月24日 00:49:30
> Either way, it's
> pretty straightforward; just change one line in the Python Makefile
> and matplotlib will install with a simple "sudo python setup.py
> install"
Huh, well there was a make target for Leopard that had that fixed 
CFLAGS that you suggested, and it seemed to build and install without 
any major complaints. If I rename the Matplotlib directory that was 
installed by the SciPy superpack, and try to fire up ipython -pylab, 
it seems to work! Woo hoo!
It looks like there's a tiny doc bug here: http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between.html
ax = fig.add_subplot(111)
ax1.plot(x, y1, x, y2, color='black')
ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
ax.set_title('fill between where')
It should be calling ax.plot() not ax1.plot()
Incidentally, when you do it with ax.plot() instead you can see more 
easily that the corners where the two sinusoidal functions intersect 
are getting kind of chopped off by the polygon filling. Don't know if 
there's an easy way to fix that - maybe by forcing the list of polygon 
vertices to always explicitly include the points of intersection 
between the functions being filled_between? Or maybe just by 
increasing the number of vertices, though I assume that would slow 
things down.
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Cohen-Tanugi J. <co...@lp...> - 2008年11月23日 23:23:06
> hi, I tried your script, commenting/uncommenting the backend line, but 
> I still get:
> [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py
> --------------------------------------------------------------------------- 
>
> AttributeError Traceback (most recent call 
> last)
>
> /home/cohen/MACROS/animation.py in <module>()
> 274 p.show()
> 275
> --> 276 t = test()
> 277
> 278
>
> /home/cohen/MACROS/animation.py in __init__(self)
> 270
> 271 # cid = p.gcf().canvas.mpl_connect('idle_event', 
> self.update)
> --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update)
> 273
> 274 p.show()
>
> AttributeError: 'NoneType' object has no attribute 'Bind'
> WARNING: Failure executing file: <MACROS/animation.py>
>
> I am using MPL revision 6440.
> cheers,
> Johann
>
> Eric Bruning wrote:
>> Hi Eric,
>> 
>>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote:
>>> 
>>>> I've looked through the latest examples as well as google and the list
>>>> archives, and am still at a loss -- can anyone point me to an 
>>>> example of
>>>> how to animate a scatter plot?
>>>> 
>>
>> I've attached a somewhat unpolished but functional example that shows
>> time-synchronized animation of multiple scatter plots. It uses the wx
>> backend explicitly, due to some issues with the idle event handling.
>>
>> 
>>>> The collection returned by scatter() lacks anything akin to a 
>>>> set_data method.
>>>> 
>>
>> Yup, you want this instead:
>> collection.set_offsets(xy)
>> collection.set_array(s)
>>
>> -Eric
>> 
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------- 
>>
>> This SF.Net email is sponsored by the Moblin Your Move Developer's 
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win 
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the 
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Joshua L. <dis...@gm...> - 2008年11月23日 22:39:53
The version of NumPy in Chris's superpack should be recent enough for
you to just need to build matplotlib from SVN and not the other stuff,
and I assume he includes installation of wxPython or some other
compatible backend for matplotlib. It's really straightforward; you
just need to get the source from svn and run the setup.py file inside
with the target "install."
Last I checked, if you were using Leopard, a bug in Apple's GCC 4.0
got angry with the -O3 optimisation flag so you had to go into
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config
and edit the Makefile to change "-O3" to "-Os" in the OPT line under
Compiler flags to get around that (there are other methods that are
slightly more complicated that don't sacrifice using O3, but I think
the "Os" change was deemed the easiest thing to do here). I don't know
if this has changed since then, so hopefully John or someone else will
correct me if this is no longer the case in Leopard. Either way, it's
pretty straightforward; just change one line in the Python Makefile
and matplotlib will install with a simple "sudo python setup.py
install"
Josh
On Sun, Nov 23, 2008 at 2:01 PM, Zane Selvans <za...@id...> wrote:
> On Nov 23, 2008, at 12:36 PM, John Hunter wrote:
>
> On Sun, Nov 23, 2008 at 1:26 PM, John Hunter <jd...@gm...> wrote:
>
> The code is much simpler than the fill_between_posneg original
>
> example, which I have just removed from svn.
>
> The fill between use case is common enough that I decided to make it
> an axes/pyplot method. No need to use the intermediate
> "mlab.poly_between" anymore. fill_between has signature::
>
> Sigh.
> I've never been able to get the whole SciPy dependency mess to successfully
> build from source, so I'm running from the OS X Superpack that Chris
> Fonnesbeck puts out at http://macinscience.org Unfortunately some of the
> versions of stuff being pulled in there are kind of stale it looks like.
> Maybe I should give it another go from source or pre-built SVN binaries.
> Has it gotten any easier lately?
> Zane
> --
> Zane Selvans
> Amateur Earthling
> za...@id...
> 303/815-6866
> http://zaneselvans.org
> PGP Key: 55E0815F
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Zane S. <za...@id...> - 2008年11月23日 22:01:35
On Nov 23, 2008, at 12:36 PM, John Hunter wrote:
> On Sun, Nov 23, 2008 at 1:26 PM, John Hunter <jd...@gm...> 
> wrote:
>
>> The code is much simpler than the fill_between_posneg original
>> example, which I have just removed from svn.
>
> The fill between use case is common enough that I decided to make it
> an axes/pyplot method. No need to use the intermediate
> "mlab.poly_between" anymore. fill_between has signature::
Sigh.
I've never been able to get the whole SciPy dependency mess to 
successfully build from source, so I'm running from the OS X Superpack 
that Chris Fonnesbeck puts out at http://macinscience.org 
Unfortunately some of the versions of stuff being pulled in there are 
kind of stale it looks like.
Maybe I should give it another go from source or pre-built SVN 
binaries. Has it gotten any easier lately?
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: John H. <jd...@gm...> - 2008年11月23日 20:36:05
On Sun, Nov 23, 2008 at 1:26 PM, John Hunter <jd...@gm...> wrote:
> http://matplotlib.sourceforge.net/examples/api/fill_where_demo.html
>
> The code is much simpler than the fill_between_posneg original
> example, which I have just removed from svn.
The fill between use case is common enough that I decided to make it
an axes/pyplot method. No need to use the intermediate
"mlab.poly_between" anymore. fill_between has signature::
 fill_between(x, y1, y2=0, where=None, **kwargs)
y1 or y2 can be scalars or length x arrays. If where is None, the
fill will be make everywhere between y1 and y2. If where is not None,
it is a len(x) np boolean array and the fill will happen only where
where==True.
The examples are all now folded into fill_between.py
http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between.html
JDH
From: John H. <jd...@gm...> - 2008年11月23日 19:27:01
On Sat, Nov 22, 2008 at 6:46 PM, Angus McMorland <am...@gm...> wrote:
> 2008年11月22日 Zane Selvans <za...@id...>:
>> Does anybody know of an easy way to take two intersecting curves, A(x) and
>> B(x), and fill the areas between them only when A(x) < B(x) and not when
>> A(x) > B(x)?
>
> Looks like this example from the new shiny matplotlib website should help:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between_posneg.html
Fortuitously, on Friday, I added a couple of methods to the polygon
collections code to make this a lot easier. I just tweaked these
examples to work with the use case in this post. Take a look at
 http://matplotlib.sourceforge.net/examples/api/fill_where_demo.html
The code is much simpler than the fill_between_posneg original
example, which I have just removed from svn.
JDH
From: John H. <jd...@gm...> - 2008年11月23日 15:36:54
On Sun, Nov 23, 2008 at 2:01 AM, Paul Ivanov <piv...@gm...> wrote:
> I took a stab at it, how does this look?
>
> I also took the liberty of adding alpha to LinearSegmentedColormap and
> updated its docstring changing two somewhat ambiguous uses of the word
> 'entry' with 'key' and 'value'.
Hey Paul,
Thanks for taking this on. I haven't tested this but I read the patch
and have some inline comments below. Some additional comments:
 * the patch should include a section in the CHANGELOG and
API_CHANGES letting people know what is different.
 * you should run examples/tests/backend_driver.py and make sure all
the examples still run, checking the output of some of the mappable
types (images, scaltter, pcolor...)
 * it would be nice to have an example in the examples dir which
exercises the new capabilities.
See also, in case you haven't,
http://matplotlib.sourceforge.net/devel/coding_guide.html, which
covers some of this in more detail.
Thanks again! Comments below:
 Index: lib/matplotlib/colors.py
 ===================================================================
 --- lib/matplotlib/colors.py	(revision 6431)
 +++ lib/matplotlib/colors.py	(working copy)
 @@ -452,7 +452,7 @@
 self._isinit = False
 - def __call__(self, X, alpha=1.0, bytes=False):
 + def __call__(self, X, alpha=None, bytes=False):
 """
 *X* is either a scalar or an array (of any dimension).
 If scalar, a tuple of rgba values is returned, otherwise
 @@ -466,9 +466,10 @@
 """
You need to document what alpha can be here: what does None mean, can
it be an array, scalar, etc...
 if not self._isinit: self._init()
 - alpha = min(alpha, 1.0) # alpha must be between 0 and 1
 - alpha = max(alpha, 0.0)
 - self._lut[:-3, -1] = alpha
 + if alpha:
I prefer to explicitly use "if alpha is None", since there are other
things that would test False (0, [], '') that you probably don't mean.
 + alpha = min(alpha, 1.0) # alpha must be between 0 and 1
 + alpha = max(alpha, 0.0)
You should be able to use np.clip(alpha, 0, 1) here, but we should
consider instead raising for illegal alpha values since this will be
more helpful to the user. I realize some of this is inherited code
from before your changes, but we can improve it while making this
patch.
 + self._lut[:-3, -1] = alpha
 mask_bad = None
 if not cbook.iterable(X):
 vtype = 'scalar'
 @@ -558,9 +559,10 @@
 def __init__(self, name, segmentdata, N=256):
 """Create color map from linear mapping segments
 - segmentdata argument is a dictionary with a red, green and blue
 - entries. Each entry should be a list of *x*, *y0*, *y1* tuples,
 - forming rows in a table.
 + segmentdata argument is a dictionary with red, green and blue
 + keys. An optional alpha key is also supported. Each value
 + should be a list of *x*, *y0*, *y1* tuples, forming rows in a
 + table.
 Example: suppose you want red to increase from 0 to 1 over
 the bottom half, green to do the same over the middle half,
 @@ -606,6 +608,8 @@
 self._lut[:-3, 0] = makeMappingArray(self.N,
self._segmentdata['red'])
 self._lut[:-3, 1] = makeMappingArray(self.N,
self._segmentdata['green'])
 self._lut[:-3, 2] = makeMappingArray(self.N,
self._segmentdata['blue'])
 + if self._segmentdata.has_key('alpha'):
 + self._lut[:-3, 3] = makeMappingArray(self.N,
self._segmentdata['blue'])
Is this what you meant? I think you would use 'alpha' rather than
'blue' here, no?
 self._isinit = True
 self._set_extremes()
 @@ -664,11 +668,10 @@
 def _init(self):
 - rgb = np.array([colorConverter.to_rgb(c)
 + rgba = np.array([colorConverter.to_rgba(c)
 for c in self.colors], np.float)
 self._lut = np.zeros((self.N + 3, 4), np.float)
 - self._lut[:-3, :-1] = rgb
 - self._lut[:-3, -1] = 1
 + self._lut[:-3] = rgba
 self._isinit = True
 self._set_extremes()
From: Paul I. <piv...@gm...> - 2008年11月23日 08:01:32
Attachments: rgba_colormap.diff
I took a stab at it, how does this look?
I also took the liberty of adding alpha to LinearSegmentedColormap and
updated its docstring changing two somewhat ambiguous uses of the word
'entry' with 'key' and 'value'.
tested with
In [1]: import matplotlib; import numpy as np
In [2]: my_rgba_array= np.array( [[ 1., 1., 1., 0.65],
 [ 1., 0., 0., 0.79]])
In [3]: myColormap = matplotlib.colors.ListedColormap(my_rgba_array)
In [4]: myColormap.__call__(.1)
Out[4]: (1.0, 1.0, 1.0, 0.65000000000000002)
In [5]: myColormap.__call__(.9)
Out[5]: (1.0, 0.0, 0.0, 0.790000000000000
In [6]: my_rgba_array= np.array( [ [ 1. , 1. , 1. ],
 [ 1. , 0. , 0. ]])
In [7]: myColormap = matplotlib.colors.ListedColormap(my_rgba_array)
In [8]: myColormap.__call__(.1)
Out[8]: (1.0, 1.0, 1.0, 1.0)
In [9]: myColormap.__call__(.9)
Out[9]: (1.0, 0.0, 0.0, 1.0)
cheers,
Paul Ivanov
John Hunter, on 2008年11月21日 05:52, wrote:
> On Fri, Nov 21, 2008 at 2:45 AM, Simon Kammerer <ko...@we...> wrote:
> 
>> After looking at the source of matplotlib.colors, it seems to me that
>> different alpha values are something Colormap is not designed for.
> 
> Yes, it looks like the colormap only holds the RGB channels, but it
> also looks fairly straightforward to patch the code to support the
> fourth channel. Is this something you'd like to tackle?
> 
> JDH
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Angus M. <am...@gm...> - 2008年11月23日 00:46:50
2008年11月22日 Zane Selvans <za...@id...>:
> Does anybody know of an easy way to take two intersecting curves, A(x) and
> B(x), and fill the areas between them only when A(x) < B(x) and not when
> A(x) > B(x)?
Looks like this example from the new shiny matplotlib website should help:
http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between_posneg.html
Angus.
> --
> Zane Selvans
> Amateur Earthling
> za...@id...
> 303/815-6866
> http://zaneselvans.org
> PGP Key: 55E0815F
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Zane S. <za...@id...> - 2008年11月23日 00:26:37
Does anybody know of an easy way to take two intersecting curves, A(x) 
and B(x), and fill the areas between them only when A(x) < B(x) and 
not when A(x) > B(x)?
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Mauro C. <mau...@gm...> - 2008年11月22日 11:50:50
Dear ALL,
Is there any example of toggling points on and off a MPL Basemap? I
see that there matplotlib artists have a handy "set_visible()" method,
but if I have a map with plotted points and use
"ax.set_visible(False)", the entire map is made invisible!
Any hints?
Thanks in advance!
Best regards,
-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
From: massimo s. <mas...@un...> - 2008年11月21日 23:32:33
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christopher Barker ha scritto:
> John Hunter wrote:
>> <Chr...@no...> wrote:
>>> Yes -- even if Ken does come back online, I'd like to see wxMPL hosted
>>> by the MPL project anyway -- it would be easier to find, and more likely
>>> to get tested and patched. Maybe as a toolkit?
>> I'd be happy to host it in the mpl_toolkits dir if someone brings it
>> up to 0.98 and will maintain it.
> 
> That would be great, John. I hope someone can take this on -- I'm doing 
> non-MPL stuff at the moment, so I can't take it no right now. Maybe in 
> the future.
I would be glad to help, however I'm very unsure about my skills! I'd
say I can try to test it these days and help trying to bring it to
compliance with 0.98 -but I can't do this alone.
In the meantime, would it be possible to host it somewhere in the mpl
svn? If not, I can open a google code page for it and use its svn until
it's ready.
m.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJJzCgpnWWEXZ5PA4RAl64AKDbzIbCectHcly38nLcS0HIr3b8ggCgpka9
ekRxn7Ac56kVqY1DdzHBfxc=
=aKto
-----END PGP SIGNATURE-----
1 message has been excluded from this view by a project administrator.

Showing results of 362

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