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






Showing results of 26

1 2 > >> (Page 1 of 2)
From: Ryan K. <rya...@gm...> - 2009年05月15日 23:59:42
RTFM:
plot(t,y, drawstyle='steps-post')
This was really helpful:
http://matplotlib.sourceforge.net/examples/pylab_examples/set_and_get.html
especially
>>> line, = plot([1,2,3])
>>> setp(line, linestyle='--')
On Fri, May 15, 2009 at 6:52 PM, Ryan Krauss <rya...@gm...> wrote:
> Oh, and in case it matters I am running
>
> In [36]: matplotlib.__version__
> Out[36]: '0.98.5.2'
>
> on Ubuntu 9.04 (with the rather lame name of Jaunty Jackolope).
>
>
> On Fri, May 15, 2009 at 6:51 PM, Ryan Krauss <rya...@gm...> wrote:
>
>> I think I used to use plot with linestyle='steps' to plot data for
>> zero-order hold control systems. This means that if the system is updating
>> on a period of 0.01 seconds (100 Hz), the values should be considered held
>> from 0 to 0.0099999999999999 and then from 0.01 to 0.01999999999 and so on
>> each time step. So, what I want is a plot that looks like late_steps.png
>> (hopefully attached), but what I am currently getting is early_steps.png.
>>
>> This code snippet recreates my problem. My t2 hack almost makes the plot
>> look right.
>>
>> t = arange(0,0.1,0.01)
>> y = 10*t
>> clf()
>> plot(t,y,linestyle='steps')
>> plot(t,y,'o')
>> savefig('early_steps.png')
>>
>> t2 = t+0.01
>> clf()
>> plot(t2,y,linestyle='steps')
>> plot(t,y,'o')
>> savefig('late_steps.png')
>>
>>
>>
>> Is this a bug, is this the expected behavior for other applications, or
>> can this be changed with some configuration setting?
>>
>> Thanks,
>>
>> Ryan
>>
>
>
From: Ryan K. <rya...@gm...> - 2009年05月15日 23:52:51
Oh, and in case it matters I am running
In [36]: matplotlib.__version__
Out[36]: '0.98.5.2'
on Ubuntu 9.04 (with the rather lame name of Jaunty Jackolope).
On Fri, May 15, 2009 at 6:51 PM, Ryan Krauss <rya...@gm...> wrote:
> I think I used to use plot with linestyle='steps' to plot data for
> zero-order hold control systems. This means that if the system is updating
> on a period of 0.01 seconds (100 Hz), the values should be considered held
> from 0 to 0.0099999999999999 and then from 0.01 to 0.01999999999 and so on
> each time step. So, what I want is a plot that looks like late_steps.png
> (hopefully attached), but what I am currently getting is early_steps.png.
>
> This code snippet recreates my problem. My t2 hack almost makes the plot
> look right.
>
> t = arange(0,0.1,0.01)
> y = 10*t
> clf()
> plot(t,y,linestyle='steps')
> plot(t,y,'o')
> savefig('early_steps.png')
>
> t2 = t+0.01
> clf()
> plot(t2,y,linestyle='steps')
> plot(t,y,'o')
> savefig('late_steps.png')
>
>
>
> Is this a bug, is this the expected behavior for other applications, or can
> this be changed with some configuration setting?
>
> Thanks,
>
> Ryan
>
From: Christopher B. <Chr...@no...> - 2009年05月15日 23:52:41
Attachments: quiver_test.py
Hi all,
I've been messing with quiver a bit, and have some confusions:
according to the docs:
"""
units: [‘width’ | ‘height’ | ‘dots’ | ‘inches’ | ‘x’ | ‘y’ ]
 arrow units; the arrow dimensions except for length are in 
multiples of this unit.
"""
and yes, when I change units from 'dots' for 'inched', the length of the 
arrows do indeed change.
"""
angles: [‘uv’ | ‘xy’ | array]
 ... Alternatively, arbitrary angles may be specified as an array of 
values in degrees, CCW from the x-axis.
"""
This crashes for me with:
Traceback (most recent call last):
 File "quiver_test.py", line 72, in <module>
 plt.draw()
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/pyplot.py", 
line 341, in draw
 get_current_fig_manager().canvas.draw()
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", 
line 215, in draw
 FigureCanvasAgg.draw(self)
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", 
line 279, in draw
 self.figure.draw(self.renderer)
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/figure.py", 
line 772, in draw
 for a in self.axes: a.draw(renderer)
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", 
line 1601, in draw
 a.draw(renderer)
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/quiver.py", 
line 425, in draw
 verts = self._make_verts(self.U, self.V)
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/quiver.py", 
line 484, in _make_verts
 theta = ma.asarray(self.angles*np.pi/180.0).filled(0)
TypeError: can't multiply sequence by non-int of type 'float'
I've enclosed a small test script...
Thanks,
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Jae-Joon L. <lee...@gm...> - 2009年05月15日 22:17:04
Attached is a patch that I want to commit to the trunk.
It introduces new attribute "_check_contains" (any name suggestion?)
for Annotation class.
 * True : the annotation will only be drawn when self.xy is
inside the axes.
 * False : the annotation will always be drawn regardless of
its position.
 * None : the self.xy will be checked only if *xycoords* is "data"
The default value is None, i.e., position is only checked if the
xycoords is "data".
I'll commit this soon if others don't object.
Regards,
-JJ
On Fri, May 15, 2009 at 3:44 AM, Ben Coppin <co...@gm...> wrote:
> Thanks! As far as I can tell, this works perfectly.
>
> I agree that this should probably be the default behaviour.
>
> Ben
>
> On Thu, May 14, 2009 at 8:03 PM, Jae-Joon Lee <lee...@gm...> wrote:
>> On Thu, May 14, 2009 at 4:36 AM, Ben Coppin <co...@gm...> wrote:
>>> Hi,
>>>
>>> I've added annotations to a graph I am producing using matplotlib. The
>>> annotations work fine, but when you zoom and pan, the annotations move off
>>> the edge of the chart and are still visible while they're in the main TK
>>> window. Does anyone know of a way to make the annotations disappear when
>>> they move off the edge of the chart?
>>
>> Currently, there is no support for this. However, a monkey patching
>> can be a quick solution for now.
>>
>>
>> from matplotlib.text import Annotation
>>
>> def draw(self, renderer):
>>  x, y = self.xy
>>  x, y = self._get_xy(x, y, self.xycoords)
>>  if not self.axes.bbox.contains(x, y):
>>    return
>>
>>  self.draw_real(renderer)
>>
>> Annotation.draw_real = Annotation.draw
>> Annotation.draw = draw
>>
>> ann = annotate("test", (0.5, 0.5), xytext=(0.6, 0.6),
>>        arrowprops=dict(arrowstyle="->"))
>>
>>
>> I think this should be the default behavior (with optionally turned
>> off). If other developers don't object, i'll try to push this feature
>> into the svn.
>>
>> Regards,
>>
>> -JJ
>>
>>
>>>
>>> Thanks,
>>>
>>> Ben
>>>
>>> ------------------------------------------------------------------------------
>>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>>> production scanning environment may not be a perfect world - but thanks to
>>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
>>> i700
>>> Series Scanner you'll get full speed at 300 dpi even with all image
>>> processing features enabled. http://p.sf.net/sfu/kodak-com
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>
From: Jae-Joon L. <lee...@gm...> - 2009年05月15日 21:24:18
>
> Exploring in this area is definitely a good thing. I kind of like this
> proposal and along those lines, I would love to be able to *easily* create a
> subplot that occupies 2/3 of a figure in each direction, surrounded by a
> bunch of smaller panels that each occupy 1/3. I know Jae-Joon has committed
> a bunch of work on what I'll call "axes tricks", but I haven't had a chance
> to see if it facilitates this.
>
> Ryan
>
It may be doable, depending on what you exactly want.
For example
http://dl.getdropbox.com/u/178748/AxesGrid/htdocs/users/overview.html#rgb-axes
But my emphasis was on displaying images, and may not be suitable for
general axes.
-JJ
From: Christopher B. <Chr...@no...> - 2009年05月15日 21:22:23
Attachments: StickPlot.py
Sandro Tosi wrote:
>> mpl.ticker.AutoDateLocator
>> mpl.ticker.AutoDateFormatter
>>
>> Where might I find these now? They don't seem to be in matplotlib.ticker
>> or matplotlib.date. do they have a new name? Is there a new way to get
>> automatic date tic location and formating?
> dates.AutoDateFormatter dates.AutoDateLocator
thanks -- I did just find it myself, by looking at the code in 
axes.plot_dates -- however, the plot_dates docstring is wrong, and they 
don't seem to be here:
http://matplotlib.sourceforge.net/api/dates_api.html
They are there in the diagram on top, but don't seem to be on the page.
>> note: I'm trying to do this for the x axis of a quiver plot, which
>> doesn't seem to support passing in dates directly.
by the way, is that a bug that should be tracked down and fixed?
> simple snippet (with some additional formatting and stuff you might need):
thanks. In this case, I'm writing plotting code that I want to work with 
time series that may span hours, or days, or weeks, or months, ...
hence by desire for Auto Formatting.
It does work, but not all that well, though:
> In [19]: fig.autofmt_xdate(bottom=0.18) # adjust for correct date labels display
Thanks, this one helps a lot.0
However, in this case, I'm trying to write method that takes an axes 
object, and plots to that -- how can I do this without the figure reference?
But it does work well if you apply it to the figure after my plotting 
routines.
see enclosed for what I'm doing -- this is for plotting wind data and 
the like, where you have a time series of speeds and directions.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Jae-Joon L. <lee...@gm...> - 2009年05月15日 20:58:21
On Fri, May 15, 2009 at 2:48 PM, Alan G Isaac <ala...@gm...> wrote:
> E.g., ax = fig.subplot2grid(shape=(5,1), loc=(0,3)).
It would be good if we can (optionally) specify a location as ranges
in each direction so that the axes can occupy not just a single cell
of the grid but can spans multiple cells, similar to what Ryan has
suggested. For example, shape(3,3), loc=((0,2), (0,2)) may create a
subplot what Ryan has suggested.
-JJ
From: Sandro T. <mo...@de...> - 2009年05月15日 20:13:17
Hi Chris,
On Fri, May 15, 2009 at 21:29, Christopher Barker <Chr...@no...> wrote:
> Hey folks,
>
> IN old mailing list messages, I see reference to:
>
> mpl.ticker.AutoDateLocator
> mpl.ticker.AutoDateFormatter
>
>
> Where might I find these now? They don't seem to be in matplotlib.ticker
> or matplotlib.date. do they have a new name? Is there a new way to get
> automatic date tic location and formating?
In [14]: from matplotlib import dates
In [15]: dates.Au
dates.AutoDateFormatter dates.AutoDateLocator
> note: I'm trying to do this for the x axis of a quiver plot, which
> doesn't seem to support passing in dates directly.
simple snippet (with some additional formatting and stuff you might need):
In [13]: dateFmt = mpl.dates.DateFormatter('%Y-%m-%d')
In [14]: ax2.xaxis.set_major_formatter(dateFmt)
In [15]: daysLoc = mpl.dates.DayLocator()
In [16]: hoursLoc = mpl.dates.HourLocator(interval=6)
In [17]: ax2.xaxis.set_major_locator(daysLoc)
In [18]: ax2.xaxis.set_minor_locator(hoursLoc)
In [19]: fig.autofmt_xdate(bottom=0.18) # adjust for correct date labels display
In [20]: fig.subplots_adjust(left=0.18)
HTH
Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: Christopher B. <Chr...@no...> - 2009年05月15日 19:28:44
Hey folks,
IN old mailing list messages, I see reference to:
mpl.ticker.AutoDateLocator
mpl.ticker.AutoDateFormatter
Where might I find these now? They don't seem to be in matplotlib.ticker 
or matplotlib.date. do they have a new name? Is there a new way to get 
automatic date tic location and formating?
note: I'm trying to do this for the x axis of a quiver plot, which 
doesn't seem to support passing in dates directly.
Thanks,
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: citronade <ric...@ma...> - 2009年05月15日 19:16:32
I had a similar issue and this thread mostly solved it, save for one
remaining bug. 
If I also call a different module in my main program that does the plotting
in MPL, and then I modify that module, then when I try to run it again in
ipython it acts as if the module I imported has not been changed. If I
change the main program those changes appear, but none of the changes in the
separate module appear. 
When I exit ipython and restart everything works normally again, but I would
rather not have to do that every time I edit one of the modules I am
importing. 
Any ideas?
Thanks.
Jae-Joon Lee wrote:
> 
> Try to put plt.draw() before plt.show().
> 
> My guess is that what show() does is to create figure windows, and in
> most cases it does not redraw the figure (Tk backend is always an
> exception). So, this may not be a bug.
> But I hope some who knows well about the backends clarify this.
> 
> Regards,
> 
> -JJ
> 
> 
> 
> 
> On Wed, May 6, 2009 at 8:14 PM, Christopher Barker
> <Chr...@no...> wrote:
>> Gökhan SEVER wrote:
>>> I am playing with some other commands to achieve updating on the same
>>> figure, no luck yet.
>>>
>>> I guess that is what you actually been trying to see? Update the
>>> figure content without opening another one?
>>
>> right.
>>
>> Christopher Barker wrote:
>>
>>> oops, no it doesn't -- what that does is give me a new figure each time,
>>> so I get a big stack of them. So I tried:
>>>
>>> fig = plt.figure(1)
>>> fig.clear()
>>>
>>> then I didn't get a new figure, but I didn't get the figure updated,
>>> either -- could this be a back-end bug? I'm using wxAgg, and IIRC, the
>>> refreshing code is pretty messed up..
>>>
>>> Off to try TK
>>
>> OK, with TK, it does refresh when I expect it to. So now to write a new
>> thread, on a wxAgg refresh bug.
>>
>> -Chris
>>
>>
>>
>>
>> --
>> Christopher Barker, Ph.D.
>> Oceanographer
>>
>> Emergency Response Division
>> NOAA/NOS/OR&R      (206) 526-6959  voice
>> 7600 Sand Point Way NE  (206) 526-6329  fax
>> Seattle, WA 98115    (206) 526-6317  main reception
>>
>> Chr...@no...
>>
>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks
>> to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
>> i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
> 
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/using-MPL-and-ipython-%22run%22-command-tp23417311p23565347.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Ryan M. <rm...@gm...> - 2009年05月15日 18:57:55
On Fri, May 15, 2009 at 1:48 PM, Alan G Isaac <ala...@gm...> wrote:
> On 5/15/2009 1:57 PM Ryan May apparently wrote:
> > I'm not sure if I like the idea of changing
> > the API or not, but if you're suggesting
>
> I'm less suggesting any particular solution
> than suggesting exploring for a solution.
>
> For example, maybe pylab.subplot could use
> the current convention, but pyplot.subplot
> would behave as expected. Also uncomfortable...
>
> OK, here's another idea. Duplicate the
> functionality, leaving subplot as a "convenience"
> function for the Matlab crowd. The new function
> could be called subplot2grid, and it would take a
> shape (2-tuple) and a location (2-tuple).
> E.g., ax = fig.subplot2grid(shape=(5,1), loc=(0,3)).
>
> Just exploring ...
Exploring in this area is definitely a good thing. I kind of like this
proposal and along those lines, I would love to be able to *easily* create a
subplot that occupies 2/3 of a figure in each direction, surrounded by a
bunch of smaller panels that each occupy 1/3. I know Jae-Joon has committed
a bunch of work on what I'll call "axes tricks", but I haven't had a chance
to see if it facilitates this.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: Alan G I. <ala...@gm...> - 2009年05月15日 18:48:45
On 5/15/2009 1:57 PM Ryan May apparently wrote:
> I'm not sure if I like the idea of changing 
> the API or not, but if you're suggesting
I'm less suggesting any particular solution
than suggesting exploring for a solution.
For example, maybe pylab.subplot could use
the current convention, but pyplot.subplot
would behave as expected. Also uncomfortable...
OK, here's another idea. Duplicate the
functionality, leaving subplot as a "convenience"
function for the Matlab crowd. The new function
could be called subplot2grid, and it would take a
shape (2-tuple) and a location (2-tuple).
E.g., ax = fig.subplot2grid(shape=(5,1), loc=(0,3)).
Just exploring ...
Cheers,
Alan Isaac
From: Ryan M. <rm...@gm...> - 2009年05月15日 17:57:23
On Fri, May 15, 2009 at 12:41 PM, Alan G Isaac <ai...@am...> wrote:
> I love Matplotlib.
>
> That said, I find the indexing subplots to be an annoyance,
> because it uses MATLAB conventions rather than Python
> conventions for indexing. I think moving this convention
> into the OO API was a mistake.
>
> Since Matplotlib is not yet 1.0,
> I am suggesting that this be "fixed".
> I understand this will cause some pain.
>
> If it cannot be fixed due to code breakage,
> how about an "origin" keyword, that can be 0 or 1?
I feel your pain. However, I'm not sure if I like the idea of changing the
API or not, but if you're suggesting changing this:
subplot(2,2,1)
to:
subplot(2, 2, 0, origin=0)
I'm -1 on it. IMO, the solution is worse than the original problem.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: Alan G I. <ai...@am...> - 2009年05月15日 17:41:40
I love Matplotlib.
That said, I find the indexing subplots to be an annoyance,
because it uses MATLAB conventions rather than Python
conventions for indexing. I think moving this convention
into the OO API was a mistake.
Since Matplotlib is not yet 1.0,
I am suggesting that this be "fixed".
I understand this will cause some pain.
If it cannot be fixed due to code breakage,
how about an "origin" keyword, that can be 0 or 1?
Cheers,
Alan Isaac
From: Jae-Joon L. <lee...@gm...> - 2009年05月15日 16:32:36
On Fri, May 15, 2009 at 10:59 AM, kevin gill <kev...@op...> wrote:
> How do I make the left chart display right to left instead of the
> default left to right?
adjust your xlim in a way that xmax is 0, i.e., xlim(10, 0).
-JJ
From: John H. <jd...@gm...> - 2009年05月15日 15:36:51
On Fri, May 15, 2009 at 9:59 AM, kevin gill <kev...@op...> wrote:
> I am a matplotlib newbie. I am trying to create a Population Pyramid
> chart, see examples here.
>
> http://bm2.genes.nig.ac.jp/RGM2/R_current/library/epicalc/man/pyramid.html
>
> I am trying to draw this as two horizontal bar charts (barh) back to back.
>
> How do I make the left chart display right to left instead of the
> default left to right?
>
> Also, are there examples of this type of chart drawn in matplotlib
> available?
No, but we should add this as a plotting function -- it could be done
fairly easily with a collections.BrokenBarHCollection or simply a list
of Rectangles. Any takers?
JDH
From: kevin g. <kev...@op...> - 2009年05月15日 15:15:26
I am a matplotlib newbie. I am trying to create a Population Pyramid 
chart, see examples here.
http://bm2.genes.nig.ac.jp/RGM2/R_current/library/epicalc/man/pyramid.html
I am trying to draw this as two horizontal bar charts (barh) back to back.
How do I make the left chart display right to left instead of the 
default left to right?
Also, are there examples of this type of chart drawn in matplotlib 
available?
Thanks
Kevin
From: John H. <jd...@gm...> - 2009年05月15日 13:02:21
On Fri, May 15, 2009 at 6:41 AM, Bala subramanian
<bal...@gm...> wrote:
> Friends,
> I have a data like the following. I dnt want to plot the data literally as
> shown below. I want to define a color red for 0, blue for 1 and yellow for
> 2. Each color represents the properly of the y-values. I want to define
> colors for values and monitor the color changes with time. I checked for
> color definition in the documentation but i cudnt make out anything. Is it
> possible. I would greatly appreciate any examples for the same.
The example belows shows the guts of what needs to be done. It
creates a dictionary mapping value to color, and uses a
BrokenBarCollection to plot the regions updating them with a list of
new facecolors on every step. Note that the "pylab animation" I use
below is for illustrative purposes only and is not supported -- rather
you need to embed the update calls in a GUI idle, timer or other
handler, as in the examples at
 http://matplotlib.sourceforge.net/examples/animation/index.html
But since I don't know what GUI you are using, I'll leave this part as
an exercise :-)
import matplotlib.pyplot as plt
from matplotlib.colors import colorConverter
import matplotlib.collections as collections
import numpy as np
Ncol = 7
x = np.array("""\
 0 0 0 1 1 1 1 1
 1 0 0 1 1 1 1 1
 2 0 0 1 1 1 1 1
 3 0 0 1 1 1 1 1
 4 0 0 1 1 1 1 1
 5 0 0 1 1 1 1 1
 6 0 0 1 1 1 1 1
 7 0 0 1 1 1 1 1
 8 0 0 1 1 0 0 1
 9 0 0 2 2 0 0 1
 10 1 1 2 2 0 0 1
 11 1 1 2 2 0 0 1
 12 1 1 2 2 0 0 1
 13 1 1 2 2 0 0 1
 14 1 1 2 2 0 0 1
 15 1 1 2 2 0 0 1
""".split(), int)
x = x.reshape(len(x)/(Ncol+1), Ncol+1)
# map value to color -- the color converter returns rgba which is what
# the collection wants
colors = (0,'red'), (1,'blue'), (2,'yellow')
colord = dict([(code, colorConverter.to_rgba(color)) for code, color in colors])
Ncol = 7
# this is for "pylab animation"
plt.ion()
xranges = [(xmin, xmin+1) for xmin in range(Ncol)]
collection = collections.BrokenBarHCollection(xranges, [0, 1])
fig = plt.figure()
ax = fig.add_subplot(111)
ax.add_collection(collection)
ax.set_xlim(0, Ncol+1)
ax.set_ylim(-0.1, 1.1)
for row in x:
 t = row[0]
 vals = row[1:]
 colors = [colord[val] for val in vals]
 collection.set_facecolors(colors)
 fig.canvas.draw()
plt.show()
From: Bala s. <bal...@gm...> - 2009年05月15日 11:42:08
Friends,
I have a data like the following. I dnt want to plot the data literally as
shown below. I want to define a color red for 0, blue for 1 and yellow for
2. Each color represents the properly of the y-values. I want to define
colors for values and monitor the color changes with time. I checked for
color definition in the documentation but i cudnt make out anything. Is it
possible. I would greatly appreciate any examples for the same.
time y1 y2 y3 y4 y5 y6 y7
0 0 0 1 1 1 1 1
1 0 0 1 1 1 1 1
2 0 0 1 1 1 1 1
3 0 0 1 1 1 1 1
4 0 0 1 1 1 1 1
5 0 0 1 1 1 1 1
6 0 0 1 1 1 1 1
7 0 0 1 1 1 1 1
8 0 0 1 1 0 0 1
9 0 0 2 2 0 0 1
10 1 1 2 2 0 0 1
11 1 1 2 2 0 0 1
12 1 1 2 2 0 0 1
13 1 1 2 2 0 0 1
14 1 1 2 2 0 0 1
15 1 1 2 2 0 0 1
Thanks,
Bala
From: Ben C. <co...@gm...> - 2009年05月15日 07:45:05
Thanks! As far as I can tell, this works perfectly.
I agree that this should probably be the default behaviour.
Ben
On Thu, May 14, 2009 at 8:03 PM, Jae-Joon Lee <lee...@gm...> wrote:
> On Thu, May 14, 2009 at 4:36 AM, Ben Coppin <co...@gm...> wrote:
>> Hi,
>>
>> I've added annotations to a graph I am producing using matplotlib. The
>> annotations work fine, but when you zoom and pan, the annotations move off
>> the edge of the chart and are still visible while they're in the main TK
>> window. Does anyone know of a way to make the annotations disappear when
>> they move off the edge of the chart?
>
> Currently, there is no support for this. However, a monkey patching
> can be a quick solution for now.
>
>
> from matplotlib.text import Annotation
>
> def draw(self, renderer):
>  x, y = self.xy
>  x, y = self._get_xy(x, y, self.xycoords)
>  if not self.axes.bbox.contains(x, y):
>    return
>
>  self.draw_real(renderer)
>
> Annotation.draw_real = Annotation.draw
> Annotation.draw = draw
>
> ann = annotate("test", (0.5, 0.5), xytext=(0.6, 0.6),
>        arrowprops=dict(arrowstyle="->"))
>
>
> I think this should be the default behavior (with optionally turned
> off). If other developers don't object, i'll try to push this feature
> into the svn.
>
> Regards,
>
> -JJ
>
>
>>
>> Thanks,
>>
>> Ben
>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
>> i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
From: Armin M. <arm...@st...> - 2009年05月15日 06:27:09
darkside schrieb:
> Hi list,
> I have to make a division that sometimes yields and inf, and I want to
> replace it by 0.
> I have try this:
> ---------------------------------------
> import pylab as p
> p.seterr(divide='raise')
> l = array vector defined along the program
> try:
> a = (dr*R*dl)/(1.-((R0/R)*p.sin(l))**2)**(1./2)
> except FloatingPointError:
> a=0
> ---------------------------------
> It works, but it doesn't return an array as expect, if some of the values
> are zero, then a = 0.
> So I tried:
> --------------------------
> a = p.zeros(len(l))
> for i in range(len(l)):
> try:
> a[i] = (dr*R*dl)/(1.-((R0/R)*p.sin(l[i]))**2)**(1./2)
> except FloatingPointError:
> a[i]=0
> --------------------------------
> But doing it this way I'm not able to get an exception:
> array([ Inf])
> And I don't know what I have to change to get an exception doing things this
> way.
You can do it that way:
a = rand(5,5)
b = a.round()
c = a/b
c[isinf(c)] = 0 # use indexing with boolean array [1] to set zero
In your case:
a = (dr*R*dl)/(1.-((R0/R)*p.sin(l))**2)**(1./2)
a[isinf(a)] = 0
HTH
Armin
[1]<http://www.scipy.org/Tentative_NumPy_Tutorial#head-0dffc419afa7d77d51062d40d2d84143db8216c2>
From: Astronomical P. <ast...@gm...> - 2009年05月15日 03:39:17
We are pleased to announce the release of APLpy 0.9.1, which includes
bug fixes, improvements, and new features.
APLpy is a python module that makes it easy to interactively produce
publication-quality plots of astronomical images in FITS format. More
details are available at
 http://aplpy.sourceforge.net/
>From the front page you can sign up to the mailing list and/or the Twitter
feed to be kept up-to-date on future releases.
Cheers,
Eli Bressert and Thomas Robitaille
From: John H. <jd...@gm...> - 2009年05月15日 03:03:37
On Thu, May 14, 2009 at 7:26 PM, darkside <in....@gm...> wrote:
> Hi list,
> I have to make a division that sometimes yields and inf, and I want to
> replace it by 0.
> I have try this:
> ---------------------------------------
> import pylab as p
> p.seterr(divide='raise')
> l = array vector defined along the program
>   try:
>       a = (dr*R*dl)/(1.-((R0/R)*p.sin(l))**2)**(1./2)
Does your code fail with a ZeroDivisionError or simply fill the array
with infs. You could try replacing the infs with zeros with
 mask = np.isinf(x)
 x[mask] = 0.
Eg,
In [1]: import numpy as np
In [2]: x = np.arange(0., 1., 0.1)
In [3]: y = 1/x
In [4]: y
Out[4]:
array([ Inf, 10. , 5. , 3.33333333,
 2.5 , 2. , 1.66666667, 1.42857143,
 1.25 , 1.11111111])
In [5]: mask = np.isinf(y)
In [6]: y[mask] = 0.
In [7]: y
Out[7]:
array([ 0. , 10. , 5. , 3.33333333,
 2.5 , 2. , 1.66666667, 1.42857143,
 1.25 , 1.11111111])
JDH
>   except FloatingPointError:
>       a=0
> ---------------------------------
> It works, but it doesn't return an array as expect, if some of the values
> are zero, then a = 0.
> So I tried:
> --------------------------
> a = p.zeros(len(l))
>   for i in range(len(l)):
>     try:
>       a[i] = (dr*R*dl)/(1.-((R0/R)*p.sin(l[i]))**2)**(1./2)
>     except FloatingPointError:
>       a[i]=0
> --------------------------------
> But doing it this way I'm not able to get an exception:
> array([ Inf])
> And I don't know what I have to change to get an exception doing things this
> way.
>
> Thank you,
> Illa
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: John H. <jd...@gm...> - 2009年05月15日 02:53:46
On Thu, May 14, 2009 at 7:59 PM, GoogleWind <goo...@16...> wrote:
>
> Yeah, Thank you.
> This works. When I set aspect='auto', the im will not changed when I zoom in
> or out. However another problem appears. When I changed the size of the
> frame. The length to width ratio is changed. So the map get an unexpected
> shape.
> Is there other suggestion to avoid this.
You need to try and explain more clearly what you want to happen under
what circumstances. You should also want to read and experiment with
the the various aspect options (auto, equal, ...)
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_aspect
JDH
From: GoogleWind <goo...@16...> - 2009年05月15日 01:00:01
Yeah, Thank you.
This works. When I set aspect='auto', the im will not changed when I zoom in
or out. However another problem appears. When I changed the size of the
frame. The length to width ratio is changed. So the map get an unexpected
shape.
Is there other suggestion to avoid this.
Huang.
-- 
View this message in context: http://www.nabble.com/the-problem-about-axe-tp23532518p23551697.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
1 message has been excluded from this view by a project administrator.

Showing results of 26

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