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





Showing 17 results of 17

From: Jeff W. <js...@fa...> - 2009年08月14日 22:28:50
P.R. wrote:
> Can someone please recommend a (semi) automatic way to create the rgb
> dictionaries needed for colormap creation?
> Basically, I have a 'general' idea of how I want my colors ordered, but Im
> finding it difficult to create the smooth transitions by manually editing
> the rgb dictionary for my custom colormap...the trial & error process is
> tedious & not very accurate...
>
> How were the matplotlib colormaps created?
> Were they created manually or programmatically?
> Was it done using a random color selection?
>
> Please help,
> Thanks,
> P.Romero
> 
P.R.: If you haven't already, you should look at the custom_cmap.py 
example.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: P.R. <rom...@ho...> - 2009年08月14日 21:53:26
Can someone please recommend a (semi) automatic way to create the rgb
dictionaries needed for colormap creation?
Basically, I have a 'general' idea of how I want my colors ordered, but Im
finding it difficult to create the smooth transitions by manually editing
the rgb dictionary for my custom colormap...the trial & error process is
tedious & not very accurate...
How were the matplotlib colormaps created?
Were they created manually or programmatically?
Was it done using a random color selection?
Please help,
Thanks,
P.Romero
From: P.R. <rom...@ho...> - 2009年08月14日 18:06:10
Eric, 
Thanks, that worked...
I have a separate question about colormaps...
I'd also like to try creating my own custom colormap by modifying an
existing cmap, inserting/removing colors by changing the values in the rgb
dictionary...
How do I retrieve the actual rgb dictionary associated with, say, cm.jet?
Thanks,
P.Romero
-----Original Message-----
From: Eric Firing [mailto:ef...@ha...] 
Sent: 2009年08月14日 12:49 PM
To: P.R.
Cc: mat...@li...
Subject: Re: [Matplotlib-users] mpl.colors.BoundaryNorm question
Eric Firing wrote:
It occurred to me after posting that imshow by default gives a 
misleading picture of the effect of the cmap and boundary norm. To get 
a clear picture, add the "interpolation='nearest'" kwarg to the imshow call.
Eric
> 
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.colors as mcolors
> import matplotlib.cm as cm
> 
> 
> boundaries = np.linspace(20, 30, 11)
> colors = cm.spectral(np.linspace(0.3, 0.8, 10))
> cmap = mcolors.ListedColormap(colors)
> norm = mcolors.BoundaryNorm(boundaries, cmap.N)
> 
> z = 20 + np.random.rand(10,20)*10
> plt.imshow(z, cmap=cmap, norm=norm)
> plt.colorbar()
> plt.show()
> 
From: Eric F. <ef...@ha...> - 2009年08月14日 17:49:31
Eric Firing wrote:
It occurred to me after posting that imshow by default gives a 
misleading picture of the effect of the cmap and boundary norm. To get 
a clear picture, add the "interpolation='nearest'" kwarg to the imshow call.
Eric
> 
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.colors as mcolors
> import matplotlib.cm as cm
> 
> 
> boundaries = np.linspace(20, 30, 11)
> colors = cm.spectral(np.linspace(0.3, 0.8, 10))
> cmap = mcolors.ListedColormap(colors)
> norm = mcolors.BoundaryNorm(boundaries, cmap.N)
> 
> z = 20 + np.random.rand(10,20)*10
> plt.imshow(z, cmap=cmap, norm=norm)
> plt.colorbar()
> plt.show()
> 
From: Alan G I. <ala...@gm...> - 2009年08月14日 16:52:46
On 8/14/2009 11:54 AM Dan Klinglesmith apparently wrote:
> I am writing a python script that is a continuous running script in which I want to update a weather data plot. [...]
> I can make the plots but can not figure how to get past "show()". 
http://www.mail-archive.com/mat...@li.../msg12365.html
Oddly this is not in the FAQ is the documentation points to a missing item:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.show
Alan Isaac
From: Dan K. <dkl...@mr...> - 2009年08月14日 16:31:59
I am writing a python script that is a continuous running script in which I want to update a weather data plot. In other words I am collecting weather data (temperature, RH, winds, etc) on a regular basis and want to update a plot of the last 24 hours worth of data.
I can make the plots but can not figure how to get past "show()". 
Suggestions?
cheers, Dan
Daniel A. Klinglesmith III
Magdalena Ridge Observatory
New Mexico Tech
(575) 835-6802
From: Christophe D. <chr...@vh...> - 2009年08月14日 15:48:31
Thanks JJ, this works fairly well. 
I was wondering if the following would also be possible: at start up, draw all the minute bars in an invisible background, and on each update only display a subset of the background. 
Regards,
Christophe
-----Original Message-----
From: Jae-Joon Lee [mailto:lee...@gm...] 
Sent: 06 August 2009 17:01
To: Christophe Dupre
Cc: matplotlib-users
Subject: Re: [Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 example
Christophe,
Unfortunately, the background is always shifted by integer pixel. So, shift in data and shift in pixel have some offset and what you see is the accumulation of this offset.
And you have to manage the pixel and and data coordinates in sync.
For example, you may try to keep the original transform and calculate the pixel shift in this coordinate. This would work if you're not worried about the overflow.
The attached example solve this with different approach. However, dx_data in this approach is not constant but fluctuate, although its mean value should be one minute.
Regards,
-JJ
On Wed, Aug 5, 2009 at 7:48 AM, Christophe Dupre<chr...@vh...> wrote:
> Hi JJ,
>
> Thanks for that. It works fairly well, but I've noticed that the graph content (the candlesticks) move slightly faster than the x axis. I've added a sleep(0.1) statement to slow things down, and we can see that at the start the first bar is displayed at around 13:15 but by the times is gets to the left, the same bar is then displayed at about 13:00.
>
> Do you have any suggestion on how to improve that?
>
> Apart from that, shifting the graph is quite fast. On my machine, I get a frame rate of 30 FPS if I redraw both X and Y axis. The rate goes much higher ( greater than 100 FPS) if I don't redraw the axis.
>
> Thanks,
>
> Christophe
>
>
> -----Original Message-----
> From: Jae-Joon Lee [mailto:lee...@gm...]
> Sent: 05 August 2009 03:36
> To: Christophe Dupre
> Cc: matplotlib-users
> Subject: Re: [Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 
> example
>
> On Tue, Aug 4, 2009 at 12:14 PM, Christophe 
> Dupre<chr...@vh...> wrote:
>> Hello,
>>
>>
>>
>> I've been playing with the animation_blit_gtk2 example 
>> (http://matplotlib.sourceforge.net/examples/animation/animation_blit_
>> gtk2.html
>>
>> ) and the latest version of matplotlib version 0.99.0-RC1.
>>
>> I've modified the example so that it displays candlesticks moving 
>> towards the lelf. The example is attached if anybody is interested.
>>
>>
>>
>>
>>
>> In my example, I'm using 1 minute bars and therefore I would like to 
>> shift the graph by 1 minute instead of a few pixels. Is there a way 
>> to convert a time difference into pixels?
>>
>
> The "get_dx_data" method coverts a pixel offset to a data offset.
> So, what you need is just to invert it.
> This requires some knowledge of transformation, but I guess the code 
> is rather self-explanatory.
>
> For example, something like below will work (sorry, I haven't 
> actually tested the code)
>
>  def get_dx_pixel(self, dx_data):
>    tp = self.ax.transData.transform_point
>    x0, y0 = tp((0, 0))
>    x1, y1 = tp((dx_data, 0))
>    return (x1-x0)
>
> Regards,
>
> -JJ
>
>>
>>
>> Thanks,
>>
>>
>>
>> Christophe
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> --------- Let Crystal Reports handle the reporting - Free Crystal 
>> Reports 2008 30-Day trial. Simplify your report design, integration 
>> and deployment - and focus on what you do best, core application 
>> coding. Discover what's new with Crystal Reports now. 
>> http://p.sf.net/sfu/bobj-july 
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.392 / Virus Database: 270.13.43/2281 - Release Date: 
> 08/04/09 05:57:00
>
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.44/2283 - Release Date: 08/05/09 18:23:00
From: Jouni K. S. <jk...@ik...> - 2009年08月14日 14:20:36
per freem <per...@gm...> writes:
> i am trying to install matplotlib-0.99 on a mac os x machine, with the
> following python:
>
> Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
I think that's the system Python (/usr/bin/python), while the installer
package works with the framework Python (/usr/local/bin/python). See:
http://matplotlib.sourceforge.net/faq/installing_faq.html#os-x-questions
http://www.python.org/download/mac/
http://www.python.org/download/releases/2.5.4/
> i also cannot where the new version was installed. does anyone know
> where the files for the new matplotlib should be? they are not in
> /Library/Frameworks/Python2.5/ it seems.
It should be in
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
> if i do:
>
> locate matplotlib | grep 0.99
>
> nothing comes up. i only see files related to the older matplotlib
> when i do "locate matplotlib" in the shell.
The locate database is only updated weekly (and that's assuming that you
keep your Mac running in the early hours in which the update is run by
default). Try
sudo periodic weekly
to update the database if you want locate to find recently created
files. The update can take quite some time.
> any ideas how i can install this? i wanted to try the .egg
> installation with "easy_install" but when i do:
>
> easy_install matplotlib
>
> it matches to a 0.98 version of matplotlib, not 0.99.
easy_install can be really bothersome. If you have an easy-install.pth
file in your site-packages directory, edit it and remove references to
the old version of matplotlib.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: per f. <per...@gm...> - 2009年08月14日 13:17:55
hi all,
i am trying to install matplotlib-0.99 on a mac os x machine, with the
following python:
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
using version 10.5.6 of mac os x. when i go to
http://sourceforge.net/projects/matplotlib/ it prompts me to download
matplotlib-0.99.0-py2.5-macosx10.5.dmg. when i download this
installer and install it, it only lets me to install it in my mac
harddrive (I don't see any option to change the installation
location.) installation goes through smoothly and in the end i get
the "installation successful" message. however, only the older
version of matplotlib comes up when i do "import matplotlib". i also
cannot where the new version was installed. does anyone know where the
files for the new matplotlib should be? they are not in
/Library/Frameworks/Python2.5/ it seems.
if i do:
locate matplotlib | grep 0.99
nothing comes up. i only see files related to the older matplotlib
when i do "locate matplotlib" in the shell.
any ideas how i can install this? i wanted to try the .egg
installation with "easy_install" but when i do:
easy_install matplotlib
it matches to a 0.98 version of matplotlib, not 0.99.
thanks for your help
Good day,
I've hit an issue that may be a bug. In a previous version of
matplotlib (.98.x) I had a picker set for lines plotted on two axes.
This was working until I upgraded to version 0.99.0. Now the first
axes's pick events never seem to fire even though they respond true if
queried with pickable(). The second axes's pick events still fire.
Using the example below, clicking on the left y's line will never
print anything, but the sin from the right will if clicked.
OS: Windows XP Pro
Python: 2.6
matplotlib version: 0.99.0 -- installed using the python2.6 windows
exe obtained from sourceforge
Code to reproduce:
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(111)
t = np.arange(0.01, 10.0, 0.01)
s1 = np.exp(t)
ax1.plot(t, s1, 'b-', picker = 4.0)
ax1.set_xlabel('time (s)')
# Make the y-axis label and tick labels match the line color.
ax1.set_ylabel('exp', color='b')
for tl in ax1.get_yticklabels():
 tl.set_color('b')
ax2 = ax1.twinx()
s2 = np.sin(2*np.pi*t)
ax2.plot(t, s2, 'r.', picker = 4.0)
ax2.set_ylabel('sin', color='r')
for tl in ax2.get_yticklabels():
 tl.set_color('r')
def onpick(event):
 thisline = event.artist
 xdata = thisline.get_xdata()
 ydata = thisline.get_ydata()
 ind = event.ind
 print 'onpick points:', zip(xdata[ind], ydata[ind])
fig.canvas.mpl_connect('pick_event', onpick)
plt.show()
Thanks for a wonderful plotting package!
-- 
View this message in context: http://www.nabble.com/onpick-on-a-2-y-plot-%28-via-twinx%28%29-%29-seems-to-only-allow-picking-of-second-axes%27s-artists-tp24971445p24971445.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2009年08月14日 07:20:44
P.R. wrote:
> Hi,
> I'd like to generate a colormap index based on an array of levels & using an
> existing colormap (Spectral).
> However, Id like the cmap index to start at the 0.3 value of the Spectral
> scale (orange/yellow area) instead of starting at the '0' scale value (red
> area), and then continue until the 0.8 value area (green)...in essence, Id
> like to do a 'slice' of a given colormap, using BoundaryNorm or some other
> function, and using my levels array in order to break up the colormap.
> 
> What would be the best way to get this done?
> Can it be easily done using existing functions, or would I need to create my
> own colormap?
One way is to extract the colors you want from spectral, and use them 
with a boundary norm. Suppose you want 10 colors because you have 11 
boundaries, and suppose they are in the range from 20 to 30:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.cm as cm
boundaries = np.linspace(20, 30, 11)
colors = cm.spectral(np.linspace(0.3, 0.8, 10))
cmap = mcolors.ListedColormap(colors)
norm = mcolors.BoundaryNorm(boundaries, cmap.N)
z = 20 + np.random.rand(10,20)*10
plt.imshow(z, cmap=cmap, norm=norm)
plt.colorbar()
plt.show()
So yes, you are creating your own colormap, but it is easy.
Eric
> 
> Please help,
> 
> Thanks,
> P.Romero
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: P.R. <rom...@ho...> - 2009年08月14日 04:10:53
Hi,
I'd like to generate a colormap index based on an array of levels & using an
existing colormap (Spectral).
However, Id like the cmap index to start at the 0.3 value of the Spectral
scale (orange/yellow area) instead of starting at the '0' scale value (red
area), and then continue until the 0.8 value area (green)...in essence, Id
like to do a 'slice' of a given colormap, using BoundaryNorm or some other
function, and using my levels array in order to break up the colormap.
What would be the best way to get this done?
Can it be easily done using existing functions, or would I need to create my
own colormap?
Please help,
Thanks,
P.Romero
From: P.R. <rom...@ho...> - 2009年08月14日 02:37:07
Nevermind, 
I found the answer; quiver also accepts the cmap & norm args...
Sorry for the double post as well...email/outlook issues...
Thanks,
P.Romero
-----Original Message-----
From: P.R. [mailto:rom...@ho...] 
Sent: 2009年08月13日 9:17 PM
To: mat...@li...
Subject: [Matplotlib-users] controlling quiver colors with C arg
Question:
If I have an array C with values for the arrow vectors' magnitudes, how can
I control the magnitude levels & colors that are assigned to the quiver
arrows?
I successfully managed to plot multi-colored arrows using the 'C' arg, but
I'd also like to control the levels & colors, and also plot a colorbar for
the arrow magnitude values.
Is this possible?
Please help,
Thanks,
P.Romero
----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: <rom...@gm...> - 2009年08月14日 02:23:02
Question:
If I have an array C with values for the arrow vectors' magnitudes, how can
I control the magnitude levels & colors that are assigned to the quiver
arrows?
I successfully managed to plot multi-colored arrows using the 'C' arg, but
I'd also like to control the levels & colors, and also plot a colorbar for
the arrow magnitude values.
Is this possible?
Please help,
Thanks,
P.Romero
From: P.R. <rom...@ho...> - 2009年08月14日 02:17:07
Question:
If I have an array C with values for the arrow vectors' magnitudes, how can
I control the magnitude levels & colors that are assigned to the quiver
arrows?
I successfully managed to plot multi-colored arrows using the 'C' arg, but
I'd also like to control the levels & colors, and also plot a colorbar for
the arrow magnitude values.
Is this possible?
Please help,
Thanks,
P.Romero
From: Eric F. <ef...@ha...> - 2009年08月14日 02:05:21
G Jones wrote:
> Hello,
> Executing the following commands from ipython --pylab produces the error 
> below:
> 
> ax = subplot(111)
> ax.pcolorfast(randn(100,100))
> ax.set_xlim(2000,2001)
> draw()
> 
> I ran into the error in a more complicated script, but this seems to be 
> a simple example to reproduce it.
> I notice if I instead use:
> ax.set_xlim(400,500)
> draw()
> I get the expected behavior, so it seems to be a combination of the 
> width being smaller than the extent, and the drawing area being off screen.
Thank you. The error is actually coming from the image code, which 
pcolorfast is using in this case, and it can be reproduced with imshow.
It is now fixed in the maintenance branch, and the fix will be 
propagated to the trunk shortly.
Eric
> 
> My matplot lib info is
> 
> In [19]: matplotlib.get_backend()
> Out[19]: 'Qt4Agg'
> 
> In [20]: matplotlib.__version__
> Out[20]: '1.0.svn'
> 
> This version was built from SVN just a couple of days ago.
> 
> Error traceback:
> 
> 
> ---------------------------------------------------------------------------
> ZeroDivisionError Traceback (most recent call last)
> 
> /home/obs/workspace/backend/<ipython console> in <module>()
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/pyplot.pyc in draw()
> 350 def draw():
> 351 'redraw the current figure'
> --> 352 get_current_fig_manager().canvas.draw()
> 353
> 354 def savefig(*args, **kwargs):
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_qt4agg.pyc 
> in draw(self)
> 128 if DEBUG: print "FigureCanvasQtAgg.draw", self
> 129 self.replot = True
> --> 130 FigureCanvasAgg.draw(self)
> 131 self.update()
> 132
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_agg.pyc 
> in draw(self)
> 313
> 314 self.renderer = self.get_renderer()
> --> 315 self.figure.draw(self.renderer)
> 316
> 317 def get_renderer(self):
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in 
> draw_wrapper(artist, renderer, *kl)
> 44 def draw_wrapper(artist, renderer, *kl):
> 45 before(artist, renderer)
> ---> 46 draw(artist, renderer, *kl)
> 47 after(artist, renderer)
> 48
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/figure.pyc in 
> draw(self, renderer)
> 773
> 774 # render the axes
> 
> --> 775 for a in self.axes: a.draw(renderer)
> 776
> 777 # render the figure text
> 
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in 
> draw_wrapper(artist, renderer, *kl)
> 44 def draw_wrapper(artist, renderer, *kl):
> 45 before(artist, renderer)
> ---> 46 draw(artist, renderer, *kl)
> 47 after(artist, renderer)
> 48
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/axes.pyc in draw(self, 
> renderer, inframe)
> 1685 if len(self.images)<=1 or 
> renderer.option_image_nocomposite():
> 1686 for im in self.images:
> -> 1687 im.draw(renderer)
> 1688 else:
> 1689 # make a composite image blending alpha
> 
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/artist.pyc in 
> draw_wrapper(artist, renderer, *kl)
> 44 def draw_wrapper(artist, renderer, *kl):
> 45 before(artist, renderer)
> ---> 46 draw(artist, renderer, *kl)
> 47 after(artist, renderer)
> 48
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in 
> draw(self, renderer, *args, **kwargs)
> 134 self.axes.get_yscale() != 'linear'):
> 135 warnings.warn("Images are not supported on 
> non-linear axes.")
> --> 136 im = self.make_image(renderer.get_image_magnification())
> 137 im._url = self.get_url()
> 138 l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds
> 
> /usr/local/lib/python2.6/dist-packages/matplotlib/image.pyc in 
> make_image(self, magnification)
> 424
> 425 # resize viewport to display
> 
> --> 426 rx = widthDisplay / numcols
> 427 ry = heightDisplay / numrows
> 428 im.apply_scaling(rx*sx, ry*sy)
> 
> ZeroDivisionError: float division
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Andrew K. <ndr...@gm...> - 2009年08月14日 00:53:40
I am currently using the annotate() method for my data points and I was
curious if there is a way to center a line of text relative to a line of
text below it. I am currently using two annotate() function calls in a row
(I need the text to be different colors) but I need the first one to act as
a title for the second (i.e. so I want it centered relative to the one
below.) I have tried to use the length of the second bit of text to center
but I just cannot seem to do it. The code looks sort of like this:
import matplotlib.pyplot as plt
.......
annotateTitle='Title'
annotateText='Blah, Blah, Blah'
plt.annotate(annotateTitle, xy=(1,1), xytext=(20,50), xycoords='data',
textcoords='offset points')
plt.annotate(annotateText, xy=(1,1), xytext=(20,20), xycoords='data',
textcoords='offset points', size='small', color='black')
Any ideas?
-Andy

Showing 17 results of 17

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