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





Showing results of 446

<< < 1 .. 6 7 8 9 10 .. 18 > >> (Page 8 of 18)
From: Darren D. <dsd...@gm...> - 2008年06月20日 01:33:34
On Thursday 19 June 2008 9:13:15 pm Bill Baxter wrote:
> On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsd...@gm...> wrote:
> > Hi Bill,
> >
> > On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:
> >> Matplot folks,
> >> Is there a way to increase all font sizes globally across the board?
> >> I played around with some RC parameters but they don't seem to have
> >> any effect.
> >
> > Here's a note from the default matplotlibrc:
> >
> > # note that font.size controls default text sizes. To configure
> > # special text sizes tick labels, axes, labels, title, etc, see the rc
> > # settings for axes and ticks. Special text sizes can be defined
> > # relative to font.size, using the following values: xx-small, x-small,
> > # small, medium, large, x-large, xx-large, larger, or smaller
> > #font.size : 12.0
> >
> > You set that size, and then set a relative size (like "medium") for your
> > other settings. I should include this in the new docs, if it is not
> > covered already.
>
> According to the docs the rc function is supposed to be able to do the
> same thing as editing matplotlibrc.
> I tried doing
> rc('font', size=20)
> and several variations of that invoked at several different places in
> my file, and it seemed to have no effect.
>
> Did I do it wrong? Does rc() not really work as advertised?
> Something completely different?
I think in this case, you need to change those settings before importing 
pylab:
import matplotlib
matplotlib.rcParams['font.size'] = 12
import pylab
or better yet, do it with a matplotlibrc file
> For what it's worth my matplotlib.pylab.__version__ is '1.1.0'
Really? That looks like numpy's version, not matplotlib's.
Darren
From: Adam M. <ram...@gm...> - 2008年06月20日 01:31:37
Hi
I have a plot that has two different y-axis scales and I want
appropriate tick marks for the different y-axes. ie I want the tick
marks on the left axis to correspond to the scale on the left axis
etc... As far as I can tell the way to accomplish this, after
consulting the documentation, is to use the tick_left() and
tick_right() methods, I therefore have the following code:
axes1.yaxis.tick_left()
axes1.yaxis.set_major_locator(pylab.MultipleLocator(0.1))
axes1.yaxis.set_minor_locator(pylab.MultipleLocator(0.05))
axes2.yaxis.tick_right()
axes2.yaxis.set_major_locator(pylab.MultipleLocator(5))
axes2.yaxis.set_minor_locator(pylab.MultipleLocator(1))
but the minor ticks are on both the left and right y-axes. How can I
make the minor ticks for axes1 only appear on the the left and the
minor ticks for axes2 appear on the right?
Cheers
Adam
From: Bill B. <wb...@gm...> - 2008年06月20日 01:13:17
On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsd...@gm...> wrote:
> Hi Bill,
>
> On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:
>> Matplot folks,
>> Is there a way to increase all font sizes globally across the board?
>> I played around with some RC parameters but they don't seem to have
>> any effect.
>
> Here's a note from the default matplotlibrc:
>
> # note that font.size controls default text sizes. To configure
> # special text sizes tick labels, axes, labels, title, etc, see the rc
> # settings for axes and ticks. Special text sizes can be defined
> # relative to font.size, using the following values: xx-small, x-small,
> # small, medium, large, x-large, xx-large, larger, or smaller
> #font.size : 12.0
>
> You set that size, and then set a relative size (like "medium") for your other
> settings. I should include this in the new docs, if it is not covered
> already.
According to the docs the rc function is supposed to be able to do the
same thing as editing matplotlibrc.
I tried doing
 rc('font', size=20)
and several variations of that invoked at several different places in
my file, and it seemed to have no effect.
Did I do it wrong? Does rc() not really work as advertised?
Something completely different?
For what it's worth my matplotlib.pylab.__version__ is '1.1.0'
--bb
From: Darren D. <dsd...@gm...> - 2008年06月20日 01:02:28
Hi Bill,
On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:
> Matplot folks,
> Is there a way to increase all font sizes globally across the board?
> I played around with some RC parameters but they don't seem to have
> any effect.
Here's a note from the default matplotlibrc:
# note that font.size controls default text sizes. To configure
# special text sizes tick labels, axes, labels, title, etc, see the rc
# settings for axes and ticks. Special text sizes can be defined
# relative to font.size, using the following values: xx-small, x-small,
# small, medium, large, x-large, xx-large, larger, or smaller
#font.size : 12.0
You set that size, and then set a relative size (like "medium") for your other 
settings. I should include this in the new docs, if it is not covered 
already.
Darren
From: Bill B. <wb...@gm...> - 2008年06月20日 00:18:14
Matplot folks,
Is there a way to increase all font sizes globally across the board?
I played around with some RC parameters but they don't seem to have
any effect.
I found that I could more or less achieve the desired result by the
following steps:
1) plot to something like subplot(6,6,1). That is, make a 6x6 plot
grid but only use the upper left subplot of it.
With that the text is large relative to the plot, but spacing is not good, so...
2) Make plot window really large so text isn't overlapping so much
3) Save result to svg
4) in Inkscape or other svg editor cut out the big unused region, and
fix badly positioned labels (e.g. text too far left in legend box).
That basically worked, but it's quite hacky.
I think it's pretty obvious why this would be useful, but if not, my
particular use case is that I want to make some graphs that will be
very small in the final document, so the text needs to be at about 9pt
in an overall bounding box of approx. 3cm x 2cm.
This question was asked once before in 2006 but apparently got no answer:
http://sourceforge.net/mailarchive/message.php?msg_name=1137144577.12809.4.camel%40inpc93.et.tudelft.nl
Thanks for any hints!
--bb
From: Adam M. <ram...@gm...> - 2008年06月20日 00:14:17
On Thu, Jun 19, 2008 at 7:07 PM, Darren Dale <dsd...@gm...> wrote:
> You are looking for two_scales.py, it is distributed with matplotlib's
> collection of examples:
> http://matplotlib.sourceforge.net/matplotlib_examples_0.98.0.zip
Thanks Darren, thats exactly what I was after. I must of overlooked that.
Cheers
Adam
From: Darren D. <dsd...@gm...> - 2008年06月20日 00:08:08
Hi Adam,
On Thursday 19 June 2008 8:01:32 pm Adam Mercer wrote:
> I'm trying to produce a single plot containing two different datasets
> that share the same x-axis but different y-axes, i.e. I would like one
> y-axis to be on the left of the plot and the other on the right hand
> side. I've looked for example that illustrates how to do this but have
> been unable to find an example. Can anyone point me to and example or
> the appropriate methods that would allow me to do this?
You are looking for two_scales.py, it is distributed with matplotlib's 
collection of examples: 
http://matplotlib.sourceforge.net/matplotlib_examples_0.98.0.zip
Darren
From: Adam M. <ram...@gm...> - 2008年06月20日 00:01:33
Hi
I'm trying to produce a single plot containing two different datasets
that share the same x-axis but different y-axes, i.e. I would like one
y-axis to be on the left of the plot and the other on the right hand
side. I've looked for example that illustrates how to do this but have
been unable to find an example. Can anyone point me to and example or
the appropriate methods that would allow me to do this?
Cheers
Adam
From: John H. <jd...@gm...> - 2008年06月19日 21:57:26
On Thu, Jun 19, 2008 at 3:37 PM, Alan G Isaac <ai...@am...> wrote:
> On 2008年6月19日, John Hunter apparently wrote:
>> This is covered somewhat in Chapter 10 of the user's guide
>> http://matplotlib.sourceforge.net/users_guide_0.98.0.pdf
>
> Your post was helpful.
> I still do not see why a figure has a canvas as data.
> I'll read that chapter.
This is just a convenience so the child can see the parent. If I have
a function that gets a line, I can do line.axes.figure.canvas and walk
backwards up the containment hierarchy to get what I need. This is
backwards because a canvas holds a figure which holds an axes which
holds a line, but everybody stores a reference to their parent. A
side effect of having so many cyclic references is that we cannot use
__del__ anywhere in the mpl class hierarchy since this breaks garbage
collection with cyclic references.
From: Alan G I. <ai...@am...> - 2008年06月19日 20:33:32
On 2008年6月19日, John Hunter apparently wrote:
> This is covered somewhat in Chapter 10 of the user's guide 
> http://matplotlib.sourceforge.net/users_guide_0.98.0.pdf 
Your post was helpful.
I still do not see why a figure has a canvas as data.
I'll read that chapter.
Thanks!
Alan
From: Daniel A. <an...@cc...> - 2008年06月19日 20:01:57
John Hunter wrote:
> I don't think this is what you want. gtk is already threaded. By
> doing things in the gtk mainloop, you are using their threading. You
> are asking for a world of pain if you try and mix in python threading
> unless you really know what you are doing. The point of the example
> is that you don't need to use python threads. All your printing and
> figure updating can be done in function calls activated by the gtk
> loop.
Ok, I think I see your point. Let me explain what I'm after, then. I'm 
doing some distributed computing and need to have a pylab process 
running remotely that accepts plotting commands. The issue is that the 
show() command takes over the main thread of execution, so I can't have 
my listening process running. Essentially I need to:
1) Pop up a figure()
2) Start the drawing loop
3) Start the socket listener
4) When the listener gets commands, execute them (plot, etc)
Is this something that I can do?
Thanks,
dan
From: John H. <jd...@gm...> - 2008年06月19日 19:32:33
On Thu, Jun 19, 2008 at 2:30 PM, Daniel Ashbrook <an...@cc...> wrote:
> John Hunter wrote:
>>
>> Use the gtk mainloop and do your figure updates in a timeout add or a
>> idle handler (as suggested in the animation tutorial at
>> http://www.scipy.org/Cookbook/Matplotlib/Animations
>
> Excellent, thanks. Your sample code adapted nicely; appended below for
> posterity.
I don't think this is what you want. gtk is already threaded. By
doing things in the gtk mainloop, you are using their threading. You
are asking for a world of pain if you try and mix in python threading
unless you really know what you are doing. The point of the example
is that you don't need to use python threads. All your printing and
figure updating can be done in function calls activated by the gtk
loop.
JDH
From: Daniel A. <an...@cc...> - 2008年06月19日 19:30:35
John Hunter wrote:
> Use the gtk mainloop and do your figure updates in a timeout add or a
> idle handler (as suggested in the animation tutorial at
> http://www.scipy.org/Cookbook/Matplotlib/Animations
Excellent, thanks. Your sample code adapted nicely; appended below for 
posterity.
dan
import gobject
import numpy as np
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
import threading, time
class PylabThread(threading.Thread):
 def __init__(self):
 threading.Thread.__init__(self)
 self.fig = plt.figure()
 ax = self.fig.add_subplot(111)
 self.line, = ax.plot(np.random.rand(10))
 ax.set_ylim(0, 1)
 def update(self):
 self.line.set_ydata(np.random.rand(10))
 self.fig.canvas.draw_idle()
 return True # return False to terminate the updates
 def run(self):
 gobject.timeout_add(100, self.update) # you can also use idle_add 
to update when gtk is idle
 plt.show()
if __name__ == "__main__":
 p = PylabThread()
 p.start()
 i = 0
 while True:
 print "%.2f: %d" % (time.time(), i)
 i += 1
 time.sleep(.5)
From: John H. <jd...@gm...> - 2008年06月19日 19:11:31
On Thu, Jun 19, 2008 at 1:40 PM, Daniel Ashbrook <an...@cc...> wrote:
> I need to have a plot window hang around and be occasionally updated by
> my script as it does things. I've been looking through examples and have
> not been able to get anything to work.
>
> My current approach, inspired by strip_chart_demo.py and others in the
> animation examples, is:
Use the gtk mainloop and do your figure updates in a timeout add or a
idle handler (as suggested in the animation tutorial at
http://www.scipy.org/Cookbook/Matplotlib/Animations
import gobject
import numpy as np
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
line, = ax.plot(np.random.rand(10))
ax.set_ylim(0, 1)
def update():
 line.set_ydata(np.random.rand(10))
 fig.canvas.draw_idle()
 return True # return False to terminate the updates
gobject.timeout_add(100, update) # you can also use idle_add to
update when gtk is idle
plt.show()
From: John H. <jd...@gm...> - 2008年06月19日 19:02:56
On Thu, Jun 19, 2008 at 12:26 PM, Cormac Purcell
<Cor...@ma...> wrote:
> Hello,
>
> I need to find a way to apply a offset and scaling factor to the X and Y
> axes on an image plot. Instead of showing the pixel number I would like
> to transform the axes to 'world' coordinates, in this case degrees of
> Right-ascension and Declination in an astronomical image. The
> transformation is defined on both axes via an offset and a scaling factor.
I believe you are looking for the "extent" argument to imshow, which
will handle a linear scaling and offset.
JDH
From: Daniel A. <an...@cc...> - 2008年06月19日 18:40:41
I need to have a plot window hang around and be occasionally updated by 
my script as it does things. I've been looking through examples and have 
not been able to get anything to work.
My current approach, inspired by strip_chart_demo.py and others in the 
animation examples, is:
import gobject, matplotlib, sys
matplotlib.use('GTKAgg')
import matplotlib.pylab as pylab
import threading, time, random
class PylabThread(threading.Thread):
 def __init__(self):
 threading.Thread.__init__(self)
 def update(self):
 pylab.draw()
 def run(self):
 gobject.idle_add(self.update)
 pylab.plot([random.random() for i in xrange(1000)])
 pylab.show()
if __name__ == "__main__":
 p = PylabThread()
 p.start()
 i = 0
 while True:
 print i
 i += 1
 time.sleep(.5)
Running this, however, yields the odd behavior that you only get numbers 
printed every half second (as you should) if you move the mouse (or hit 
keys, or otherwise generate events) within the plot window!
What's going on, and how can I fix this?
Thanks!
dan
From: Cormac P. <Cor...@ma...> - 2008年06月19日 18:08:45
Hello,
I need to find a way to apply a offset and scaling factor to the X and Y 
axes on an image plot. Instead of showing the pixel number I would like 
to transform the axes to 'world' coordinates, in this case degrees of 
Right-ascension and Declination in an astronomical image. The 
transformation is defined on both axes via an offset and a scaling factor.
For example in PGPLOT this can be accomplished by specifying a 
transformation vector with the call to 'pgimag()'.
http://www.icp.uni-stuttgart.de/~feri/pgplot.html#PGIMAG
Despite looking at the examples in the tar-ball I cannot seem to find 
similar functionality - likely because I am new to matplotlib.
Can anybody point me in the right direction?
Thanks,
Cormac
From: John H. <jd...@gm...> - 2008年06月19日 17:36:06
Attachments: align_ylabels.png
On Thu, Jun 19, 2008 at 11:02 AM, John Hunter <jd...@gm...> wrote:
>> I want to adjust the x position of my ylabel, like
>>
>> subplot(111)
>> ylabel('YLabel', x=-.25, y=.75)
>>
>> the 'y=.75' argument is applied but the 'x=-.2' argument has no affect.
>> But why? Have you any idea to do this?
>
> The x position is automatically determined by the size of the
> yticklabels. We should provide a means to override this x position,
> but it is not possible currently.
Since our typical mantra is "we don't do much autolayout but we make
it possible for you to layout your figure as you like", I wasn't
satisfied with my answer, so I committed a patch to svn which supports
setting the label coords. See the example below
import numpy as np
import matplotlib.pyplot as plt
box = dict(facecolor='yellow', pad=5, alpha=0.2)
fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)
ax1 = fig.add_subplot(221)
ax1.plot(2000*np.random.rand(10))
ax1.set_title('ylabels not aligned')
ax1.set_ylabel('misaligned 1', bbox=box)
ax1.set_ylim(0, 2000)
ax3 = fig.add_subplot(223)
ax3.set_ylabel('misaligned 2',bbox=box)
ax3.plot(np.random.rand(10))
labelx = -0.3 # axes coords
ax2 = fig.add_subplot(222)
ax2.set_title('ylabels aligned')
ax2.plot(2000*np.random.rand(10))
ax2.set_ylabel('aligned 1', bbox=box)
ax2.yaxis.set_label_coords(labelx, 0.5)
ax2.set_ylim(0, 2000)
ax4 = fig.add_subplot(224)
ax4.plot(np.random.rand(10))
ax4.set_ylabel('aligned 2', bbox=box)
ax4.yaxis.set_label_coords(labelx, 0.5)
plt.show()
From: John H. <jd...@gm...> - 2008年06月19日 17:34:11
On Thu, Jun 19, 2008 at 11:23 AM, Bryan Fodness <bry...@gm...> wrote:
> I have an axes instance that I would like to rotate. I see that there is a
> rotation keyword for text and would like to do something like that with a
> plot. Is this possible.
Not currently, no.
JDH
From: KURT P. <pet...@ms...> - 2008年06月19日 16:37:15
Thanks, sadly, I DID download them and had them in the right directory. I 
had just not decompressed them!
Kurt
------------------------------
Message: 4
Date: 2008年6月19日 14:47:51 +0100
From: Jose G?mez-Dans <jgo...@gm...>
Subject: Re: [Matplotlib-users] tesgdal in examples of basemap
To: mat...@li...
Message-ID: <200...@gm...>
Content-Type: text/plain; charset="iso-8859-1"
Hi,
On Thursday 19 June 2008 00:16:39 KURT PETERS wrote:
 > array = gd.ReadAsArray()
 > AttributeError: 'NoneType' object has no attribute 'ReadAsArray'
 >
 > Anyone know what the problem is? Do I need something else?
Did you download the Denver DEM from USGS? From testgdal.py:
# download from
# http://edcftp.cr.usgs.gov/pub/data/DEM/250/D/denver-w.gz
It should work after that...
Cheers,
Jose
--
NERC Centre for Terrestrial Carbon Dynamics,
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
From: Bryan F. <bry...@gm...> - 2008年06月19日 16:23:45
I have an axes instance that I would like to rotate. I see that there is a
rotation keyword for text and would like to do something like that with a
plot. Is this possible.
-- 
"The game of science can accurately be described as a never-ending insult to
human intelligence." - João Magueijo
"Any intelligent fool can make things bigger, more complex, and more
violent. It takes a touch of genius - and a lot of courage - to move in the
opposite direction. " -Albert Einstein
From: John H. <jd...@gm...> - 2008年06月19日 16:03:03
On Thu, Jun 19, 2008 at 5:16 AM, Friedrich Hagedorn <fri...@gm...> wrote:
> Hello,
>
> I want to adjust the x position of my ylabel, like
>
> subplot(111)
> ylabel('YLabel', x=-.25, y=.75)
>
> the 'y=.75' argument is applied but the 'x=-.2' argument has no affect.
> But why? Have you any idea to do this?
The x position is automatically determined by the size of the
yticklabels. We should provide a means to override this x position,
but it is not possible currently.
JDH
From: John H. <jd...@gm...> - 2008年06月19日 15:56:48
On Thu, Jun 19, 2008 at 8:58 AM, Alan G Isaac <ai...@am...> wrote:
> On 2008年6月19日, Scott Sinclair apparently wrote:
>> canvas = FigureCanvas(fig)
>
> What is the relationship between a figure and a canvas?
The Figure is the top level matplotlib artist container that contains
all the other matplotlib.artist.Artist instances (Axes, Line2D,
etc..). Artists don't know anything about output formats (GDK, PS,
SVG) but they do know about renderers
(matplotlib.backend_bases.RendererBase) which have methods like
draw_line, draw_rectangle, and draw_text. The renderer subclasses
know the various output languages like postscript or svg. The canvas
is the target of the drawing by the renderer, and the canvas puts all
the pieces together. The canvas contains a renderer that knows how to
draw on the canvas, and it also contains the figure instance to be
drawn. The canvas calls
 fig.draw(renderer)
and then the figure instance in turn calls
 self.figurePatch.draw(renderer)
and then the figurePatch, a matplotlib.patches.Rectangle instance, calls
 renderer.draw_rectangle(graphicscontext, 25, 40)
So the renderer doesn't know anything about the matplotlib artist
Rectangle, but the Rectangle knows how to tell the renderer to draw
itself. This design decouples the functionality to make it possible
to change the artists w/o affecting the renderers, so the drawing API
is not affected by the matplotlib artist classes. This is covered
somewhat in Chapter 10 of the user's guide
http://matplotlib.sourceforge.net/users_guide_0.98.0.pdf
JDH
From: John H. <jd...@gm...> - 2008年06月19日 15:43:52
On Wed, Jun 18, 2008 at 2:43 PM, Curtis Jensen <cu...@th...> wrote:
> Nice. Thanks. I had tried to do something similar, but kept getting
> a curved line between each data point.
> Also, I too got errors with a previous versions of matplotlib, but 0.98 works.
>
> If someone were willing to add Radar plots to the matplotlib
> functionality, would this be wanted by the users or maintainers?
Yes, certainly. You may want to take a look at the polar
implementation (can you inherit from it?) to reuse as much as
possible. Michael has also written a short guide to developers
working with nonlinear projections
http://matplotlib.sourceforge.net/doc/html/devel/add_new_projection.html
JDH
From: John H. <jd...@gm...> - 2008年06月19日 15:31:08
On Wed, Jun 18, 2008 at 2:42 PM, David Warde-Farley <dw...@cs...> wrote:
> One more related thing: is there any way to retrieve the size of a textbox
> in figure coordinates, something like
> ax.get_ymajorticklabels[0].get_width()?
This is not very easy since the renderer is not known until the figure
is drawn. After the window is drawn and the text instance knows its
renderer, you can call t.get_window_extent(). So you would likely
want to connect to the "on_draw" method and get the window extent
there, and then do something with it, eg move the left of the canvas
over. Here is a recursive, iterative solution that will gradually
move the left of the subplot over until the label fits w/o going
outside the figure border (requires 0.98)::
 import matplotlib.pyplot as plt
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.plot(range(10))
 ax.set_yticks((2,5,7))
 labels = ax.set_yticklabels(('really, really, really', 'long', 'labels'))
 def on_draw(event):
 for label in labels:
 bbox = label.get_window_extent()
 if bbox.xmin<0:
 print 'adjusting left of subplot'
 fig.subplots_adjust(left=1.1*fig.subplotpars.left)
 fig.canvas.draw()
 break
 fig.canvas.mpl_connect('draw_event', on_draw)
 plt.show()
> Also, I'm kind of wondering why things like set_text() on that doesn't work.
> In general I haven't had much success with editing the properties of objects
> like this.
The tick labels are a bit special, since they are generated on the fly
(eg if you are panning and zooming, new ticks must be created and sold
ones destroyed). So you can't set their text directly, but rather
need to create a tick locator and a tick formatter as described in
Users Guide Chapter 6 -
http://matplotlib.sourceforge.net/users_guide_0.98.0.pdf and the
examples
 http://matplotlib.sourceforge.net/examples/pylab/custom_ticker1.py
 http://matplotlib.sourceforge.net/examples/pylab/major_minor_demo1.py
JDH
4 messages has been excluded from this view by a project administrator.

Showing results of 446

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