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




Showing results of 219

<< < 1 .. 7 8 9 (Page 9 of 9)
From: Benoit D. <Ben...@uc...> - 2007年07月04日 12:03:40
Thanks for the advice, Jeff. That's really what I was looking for.
I still have another question (I'm sorry for that). Is it possible =20
to increase the linewidth of the box plot (and change the color - =20
i.e., from blue to black)? In the documentation, I don't see any =20
option for boxplot regarding that point (the "widths" option refers =20
to the width of the box, not the line).
I agree it is a cosmetic question but I think it would be better in a =20=
paper if I can change the linewidth and color.
Thanks in advance.
Keep on rockin'
Benoit
Le 03-juil.-07 =E0 19:52, Jeff Whitaker a =E9crit :
> Benoit Donnet wrote:
>> Hey guys,
>>
>> I'm trying to plot quantiles information (percentile 10, 25, 50, =20
>> 75 and 90). Attached, you'll find a jpged of what I would like to =20=
>> do (this was done using Gnuplot): the vertical line delineates the =20=
>> range from the 10th to the 90th percentile. Small tick bars to =20
>> either side of the lines mark some additional percentiles: bar to =20
>> the left for the 25th and bar to the right for the 75th. Finally, =20=
>> dots mark the median.
>>
>> I attempted to use matplotlib.finance modules. In particular, the =20=
>> candlestick stuffs are quite close to what I want. But it didn't =20
>> work as the X-Axis does not correspond to a date information (X-=20
>> Axis values are within the range [1:1780]).
>>
>> Have you got an idea on how I can plot that using matplotlib?
>>
>> Thanks in advance.
>>
>> Keep on rockin'
>>
>> Benoit
>>
>
> Benoit: This looks very similar to what the boxplot function does =20
> (see http://matplotlib.sourceforge.net/matplotlib.pylab.html#-=20
> boxplot and boxplot_demo.py). If you want to tweak it, the boxplot =20=
> function in axes.py might be a good starting point.
>
> -Jeff
>
> --=20
> 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-124
> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>
--
Dr. Benoit Donnet
Universit=E9 Catholique de Louvain (UCL)
Facult=E9 des Sciences Appliqu=E9es - D=E9partement d'Ing=E9nierie =20
Informatique (INGI)
Place Sainte Barbe, 2
1348 Louvain-la-Neuve
Belgium
Phone: +32 10 47 87 18
Home page: http://inl.info.ucl.ac.be/donnet
From: Giorgio F. G. <gi...@gi...> - 2007年07月03日 23:47:21
I am encountering a font problem when I try to save in .PS or .EPS format.
I am using matplotlib 0.90 on windows xp but I had the very same
problem with the older version too.
See attached output:
http://img207.imageshack.us/img207/3966/croppercapture11kg8.jpg
Any idea?
-- 
Giorgio
gi...@gi...
http://www.cafelamarck.it
From: Jeff W. <js...@fa...> - 2007年07月03日 17:52:21
Benoit Donnet wrote:
> Hey guys,
>
> I'm trying to plot quantiles information (percentile 10, 25, 50, 75 
> and 90). Attached, you'll find a jpged of what I would like to do 
> (this was done using Gnuplot): the vertical line delineates the range 
> from the 10th to the 90th percentile. Small tick bars to either side 
> of the lines mark some additional percentiles: bar to the left for the 
> 25th and bar to the right for the 75th. Finally, dots mark the median.
>
> I attempted to use matplotlib.finance modules. In particular, the 
> candlestick stuffs are quite close to what I want. But it didn't work 
> as the X-Axis does not correspond to a date information (X-Axis values 
> are within the range [1:1780]).
>
> Have you got an idea on how I can plot that using matplotlib?
>
> Thanks in advance.
>
> Keep on rockin'
>
> Benoit
>
Benoit: This looks very similar to what the boxplot function does (see 
http://matplotlib.sourceforge.net/matplotlib.pylab.html#-boxplot and 
boxplot_demo.py). If you want to tweak it, the boxplot function in 
axes.py might be a good starting point.
-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-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Christopher B. <Chr...@no...> - 2007年07月03日 17:47:41
Nicolas wrote:
> I think however matplotlib may be used only (and it will be even better 
> as I plan to make a Qt version in the future)
good idea.
> So, in :
> >>> from matplotlib.transforms import Value
> >>> from matplotlib.backends.backend_agg import RendererAgg
> >>> r = RendererAgg(50, 50, Value(72))
> >>> r.draw_image (0, 0, im)
> 
> What is the correct format for im ?
I'm no expert, but probably a string that's the same format as what 
tostring_argb() returns, so something like this should work (untested!):
buffer = self.get_renderer().tostring_argb()
l, h = self.GetSize()
matrix = numpy.fromstring(buffer, dtype=numpy.byte)
matrix.shape = (l,h,4) # 4 for a,r,g,b
sub_matrix = matrix[min_x:max_x, min:y_max_y, :]
r.draw_image (0, 0, sub_matrix.tostring())
-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: Paul K. <pki...@ja...> - 2007年07月03日 15:56:10
Hi,
I would like to be able to use matplotlib as an object canvas, where
items on the canvas receive mouse events (enter, leave, press, release)
and the registered callback is invoked.
For example, I want to be able to highlight the line associated with
the legend entry as I mouse over the legend, and conversely highlight 
the legend entry associated with the line as I mouse over the line.
I will also want to do operations such right clicking on the axis to
modify axis properties such as linear/log scale, and click on legend
entries to toggle lines on and off.
>From looking at the pick_event_demo in examples, I have a lot of work 
ahead of me. Is this the state of the art?
Before diving in and figuring out how to do some of these things, I
would like to know if others have already implemented similar features
in the current architecture, and if there are any plans in the works
for upgrading the architecture that would make this easier.
Thanks in advance,
	- Paul
From: Jeff W. <js...@fa...> - 2007年07月03日 11:59:15
Michael Newman wrote:
> My understanding is the "contour" method only handles plots of 
> functions, e.g. f(x,y) = z, and not discrete points. I tried looking 
> into this weeks ago, and couldn't find a way to handle discrete points.
>
> I'd love to be able to do Kriging or Inverse Distance Weighting contour 
> lines on XY points I have of pollution concentrations at various monitors...
>
> 
Michael: There are three different methods for doing this described at
http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Michael N. <mic...@gm...> - 2007年07月03日 09:55:16
My understanding is the "contour" method only handles plots of 
functions, e.g. f(x,y) = z, and not discrete points. I tried looking 
into this weeks ago, and couldn't find a way to handle discrete points.
I'd love to be able to do Kriging or Inverse Distance Weighting contour 
lines on XY points I have of pollution concentrations at various monitors...
From: Nicolas <nic...@ya...> - 2007年07月03日 08:32:40
Thank you very much.
I know very little about numpy in fact.
If I don't find a pure matplotlib method, I will use your suggestion with
wx.
I think however matplotlib may be used only (and it will be even better as I
plan to make a Qt version in the future)
So, in :
>>> from matplotlib.transforms import Value
>>> from matplotlib.backends.backend_agg import RendererAgg
>>> r = RendererAgg(50, 50, Value(72))
>>> r.draw_image(0, 0, im)
What is the correct format for im ?
Thanks,
Nicolas
On 7/2/07, Christopher Barker <Chr...@no...> wrote:
>
> I don't know how to do it with the MPL agg back-end, but I think you
> mentioned wx, and you can do it there instead. a wxImage can be
> constructed from a buffer object, then saved as a PNG. You may need to
> set the rgb and alpha portions separately. See the wxPython wiki and
> search for "Image".
>
> Also:
>
> > matrix = []
> > buffer = self.get_renderer().tostring_argb()
> > l, h = self.GetSize()
> > for ligne in xrange(h):
> > matrix.append([])
> > for colonne in xrange(l):
> > i = 4*(ligne*h + colonne)
> > pixel = buffer[i:i+4]
> > matrix[-1].append(pixel)
>
> This is a very slow way to create the numpy array!
>
> Option a: first create an empty array:
>
> matrix = numpy.empty((l,h,4), numpy.byte)
>
> then fill that in. but even better:
>
> you can build the array directly from the buffer string:
>
> matrix = numpy.fromstring(buffer, dtype=numpy.byte)
> lotlib-users
>
> --
> 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: Benoit D. <ben...@uc...> - 2007年07月03日 08:13:32
Attachments: Surveyors.jpg
Hey guys,
I'm trying to plot quantiles information (percentile 10, 25, 50, 75 
and 90). Attached, you'll find a jpged of what I would like to do 
(this was done using Gnuplot): the vertical line delineates the range 
from the 10th to the 90th percentile. Small tick bars to either side 
of the lines mark some additional percentiles: bar to the left for 
the 25th and bar to the right for the 75th. Finally, dots mark the 
median.
I attempted to use matplotlib.finance modules. In particular, the 
candlestick stuffs are quite close to what I want. But it didn't 
work as the X-Axis does not correspond to a date information (X-Axis 
values are within the range [1:1780]).
Have you got an idea on how I can plot that using matplotlib?
Thanks in advance.
Keep on rockin'
Benoit
From: Christopher B. <Chr...@no...> - 2007年07月02日 21:57:04
I don't know how to do it with the MPL agg back-end, but I think you 
mentioned wx, and you can do it there instead. a wxImage can be 
constructed from a buffer object, then saved as a PNG. You may need to 
set the rgb and alpha portions separately. See the wxPython wiki and 
search for "Image".
Also:
> matrix = []
> buffer = self.get_renderer().tostring_argb()
> l, h = self.GetSize()
> for ligne in xrange(h):
> matrix.append([])
> for colonne in xrange(l):
> i = 4*(ligne*h + colonne)
> pixel = buffer[i:i+4]
> matrix[-1].append(pixel)
This is a very slow way to create the numpy array!
Option a: first create an empty array:
matrix = numpy.empty((l,h,4), numpy.byte)
then fill that in. but even better:
you can build the array directly from the buffer string:
matrix = numpy.fromstring(buffer, dtype=numpy.byte)
lotlib-users
-- 
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: Matthias M. <Mat...@gm...> - 2007年07月02日 21:50:21
Hello everybody,
first of all I hope my mails on the issue 'Prompt/TextBox/InputButton' don't 
become to many. 
But I had one more idea and I want to share it with you.
If you don't like my usage of lists as a pointer to variables, one could 
replace this in two steps: 
1) Adding a new method 'get_text' to get the actual label text 
(def get_text(self): 
 return self.label.get_text() )
2) In the example one would include a function to set one's variable to the 
evaluated label-text. Than one would add this function into the 
self.observers and so call it after every finished typing mode.
This new behaviour has the big advance that error-handling during evaluation 
of the text is a task for users and not to mpl. 
I hope I could explain my idea ...
best regards,
Matthias
On Wednesday 27 June 2007 18:19, Matthias Michler wrote:
> Hello everybody,
>
> in my last version I forgot to include a very useful function (it is
> comparable with the 'Button.on_clicked' function). I added it now. It
> allows the user to interact with other widgets ( I needed it to interact
> with the Silder) or his own program (e.g. updating external values or
> plots).
>
> I attached this new version.
>
> best regards,
> Matthias
>
> On Tuesday 26 June 2007 19:46, Matthias Michler wrote:
> > Hello John,
> > Hello all,
> >
> > I thought once more about the textbox and added some of your (Johns)
> > features to my class 'InputButton'. Probably my solution isn't the best
> > possible, but I attached this version to express what I'm thinking of and
> > to see what others think about my solution and needed skills of the
> > textbox .
> >
> > Could this be helpful / useful for others?
> >
> > best regards,
> > Matthias
> >
> > On Wednesday 06 June 2007 17:25, John Hunter wrote:
> > > On 6/6/07, Matthias Michler <Mat...@gm...> wrote:
> > > > By the way: What do you think about the "insert a 'l' or 'g' into
> > > > your TextBox and get a grid or log-scale"-issue? Is there a
> > > > possibility to switch the mpl-meaning of 'l', 'g' and 'f' off?
> > >
> > > Yes, this is clearly an issue that has to be dealt with in a cleanup.
> > > The current implementation has no concept of whether the text box is
> > > the active widget. We would need to do something like activate the
> > > text box when you click on it (and figure out the right cursor
> > > location based on the click if there is already text in there) and
> > > deactivate it on a carriage return or click in another axes. The
> > > current implementation was only a proof of concept.
> > >
> > > JDH
From: Eric F. <ef...@ha...> - 2007年07月02日 20:36:50
Andrew McLean wrote:
[...]
> Dorling cartograms described here (with an example near the bottom of 
> the page):
> 
> http://www.ncgia.ucsb.edu/projects/Cartogram_Central/types.html
Thanks for the link.
Eric
> 
> Regards,
> 
> Andrew
From: Jonathan G. <jon...@gr...> - 2007年07月02日 20:24:40
In matplotlib 0.90.1 the behavior of legend() seems to have changed.
Here's a test code fragment:
---------------------------
import pylab
import numpy
y=numpy.arange(-10,10)**2
print y
pylab.plot(y)
pylab.legend()
pylab.show()
---------------------------
Running on python 2.5.1, matplotlib 0.90.0 gives me a reasonable-looking
legend in upper right corner with label "line0".
matplotlib 0.90.1 gives an empty rectangular box, fairly large, right in
the middle of the plot.
Attempting to move the legend with loc=2 or whatever has no effect.
However, giving an explicit label ( pylab.legend(['line1']) ) makes it
start working the same as 0.90.0.
I started looking at the source but don't have time today to understand
how this is supposed to work. Maybe later.
Is this the intended behavior? The announcement for 0.90.1 says:
"Display only meaningful labels when calling legend() without args."
It's not clear to me what this means.
-- 
 Jonathan Griffitts
AnyWare Engineering Boulder, CO, USA
From: Andrew M. <an...@an...> - 2007年07月02日 19:49:17
Eric Firing wrote:
> Andrew McLean wrote:
>> It all works. However, I saw in the API documentation (and the source)
>> that there is a Circle object in patch. I was hoping that using this
>> rather than polygons would give better quality output and possibly
>> smaller files. Now I can instantiate it
>>
>> circle = Circle((x,y), c[3], facecolor=cmapper.to_rgba(v))
>>
>> but can't work out what to do with it! I've tried
>>
>> ax.add_patch( circle )
>
> This works for me in the sense that I can put circles or ellipses on a 
> plot. Note that if you are trying to do this interactively you need 
> to explicitly call draw() or draw_if_interactive() (pylab functions) 
> after the call to add_patch, because the axis methods differ from 
> pylab functions in that the latter automatically call 
> draw_if_interactive() but the former do not.
>
That was useful. Thanks. Turns out the problem was that I wasn't setting 
the axis limits. I added:
 axis([xmin, xmax, ymin, ymax])
and it all worked.
> The circle in data coordinates is a circle, however, only if you use a 
> 1:1 aspect ratio. Does this suit your needs? If so you can get it 
> with the pylab axis('equal') or axis('scaled') command. Or do you 
> really want to specify the radius of the circle in x-data units or in 
> y-data units? (I have no idea what a Dorling Cartogram is.)
I was using axis('equal'). And yes this is what I want ;-). The x and y 
data units should map to the same physical scale and the radius is in 
those units.
Dorling cartograms described here (with an example near the bottom of 
the page):
http://www.ncgia.ucsb.edu/projects/Cartogram_Central/types.html
Regards,
Andrew
From: Angel L. <an...@gm...> - 2007年07月02日 09:49:59
Hello,
I started using pylab-matplotlib some weeks ago. And it is really good.
I'm working now on windows (TkAgg).
I have written a small app that reads a file and plot it. User can
press a key to read another file, and plot it over. The problem is
that the I have to resize the plot window to see the new plotted line.
Here is the code:
import sys
import os
import tkFileDialog
import pylab
pylab.hold(1)
path='E:\\Nima'
def keyp(event):
 global path
 if event.key.lower()=='o':
 fin = tkFileDialog.askopenfilename(initialdir=path)
 path=os.path.split(fin)[0]
 plot2(fin)
def plot2(fin):
 global myplot
 f=file(fin, 'r')
 lines=f.readlines()
 f.close()
 X=[]
 Y=[]
 for line in lines[1:]:
 line=line.replace(',', '.')
 X.append(float(line.split('\t')[2]))
 Y.append(float(line.split('\t')[5]))
 myplot.plot(X, Y)
 myplot.grid()
 myplot.draw()
if __name__=='__main__':
 myplot=pylab.subplot(111)
 kid=pylab.connect('key_press_event', keyp)
 pylab.xlabel('Area [A2/molecule]')
 pylab.ylabel('SP [mN/m]')
 fin = tkFileDialog.askopenfilename(initialdir=path)
 path=os.path.split(fin)[0]
 pylab.show()
 plot2(fin)
Thanks in advance for your help.
From: Eric F. <ef...@ha...> - 2007年07月02日 07:21:10
Andrew McLean wrote:
> I'm a new user of matplotlib (athough I have been using both Matlab and
> Python for years).
> 
> I have an application where I need to display data as a set of filled
> circles. The centre and the radius of the circles are both specified in
> data coordinates. The data points have an additional scalar attribute,
> which is displayed using a pseudo-colour mapping.
> 
> I've hacked something together where the circles are approximated by
> polygons using either the axis fill method or the pylab fill function. I
> select the colour by calling the get_rgba method of a ScalarMappable
> object. In the following code snippet c is a tuple containg the x and y
> coords of the centre of the circle, the radius, and a scalar "value"
> 
> theta = arange(numSegs+1) * 2.0 * math.pi / numSegs
> cos_theta = cos(theta)
> sin_theta = sin(theta)
> for c in cart:
> x = c[1] + c[3] * cos_theta
> y = c[2] + c[3] * sin_theta
> v = c[4]
> fill(x, y, facecolor=mapper.to_rgba(v), linewidth=0.5)
> 
> It all works. However, I saw in the API documentation (and the source)
> that there is a Circle object in patch. I was hoping that using this
> rather than polygons would give better quality output and possibly
> smaller files. Now I can instantiate it
> 
> circle = Circle((x,y), c[3], facecolor=cmapper.to_rgba(v))
> 
> but can't work out what to do with it! I've tried
> 
> ax.add_patch( circle )
This works for me in the sense that I can put circles or ellipses on a 
plot. Note that if you are trying to do this interactively you need to 
explicitly call draw() or draw_if_interactive() (pylab functions) after 
the call to add_patch, because the axis methods differ from pylab 
functions in that the latter automatically call draw_if_interactive() 
but the former do not.
The circle in data coordinates is a circle, however, only if you use a 
1:1 aspect ratio. Does this suit your needs? If so you can get it with 
the pylab axis('equal') or axis('scaled') command. Or do you really want 
to specify the radius of the circle in x-data units or in y-data units? 
 (I have no idea what a Dorling Cartogram is.)
> 
> and also
> 
> trans = blend_xy_sep_transform( ax.transAxes, ax.transData )
This doesn't sound like what you want at all; it is used when you want 
to specify the x-coordinate in normalized axes units and the 
y-coordinate in data units.
Eric
> circle.set_transform( trans )
> ax.add_patch( circle )
> 
> Neither work. Any ideas?
> 
> Regards,
> 
> Andrew
From: Andrew M. <and...@an...> - 2007年07月02日 00:09:58
Steve,
I guess I should have highlighted the difference. For my application I 
need the circle radii to be given in data coordinates. For the curious, 
I'm plotting something very similar to Dorling Cartograms. I did look in 
the source of "scatter" for clues, but it uses a 20 sided polygon to 
approximate a circle. It looks like scatter_classic did what I wanted, 
but that's been removed :-(.
- Andrew
Stephen George wrote:
> It *seems* like it already does what you are trying to do?, maybe I'm 
> missing something in my understanding.
>
> Steve
>
>
>
> Andrew McLean wrote:
>> I'm a new user of matplotlib (athough I have been using both Matlab and
>> Python for years).
>>
>> I have an application where I need to display data as a set of filled
>> circles. The centre and the radius of the circles are both specified in
>> data coordinates. The data points have an additional scalar attribute,
>> which is displayed using a pseudo-colour mapping.
>>
>> I've hacked something together where the circles are approximated by
>> polygons using either the axis fill method or the pylab fill function. I
>> select the colour by calling the get_rgba method of a ScalarMappable
>> object. In the following code snippet c is a tuple containg the x and y
>> coords of the centre of the circle, the radius, and a scalar "value"
>>
>> theta = arange(numSegs+1) * 2.0 * math.pi / numSegs
>> cos_theta = cos(theta)
>> sin_theta = sin(theta)
>> for c in cart:
>> x = c[1] + c[3] * cos_theta
>> y = c[2] + c[3] * sin_theta
>> v = c[4]
>> fill(x, y, facecolor=mapper.to_rgba(v), linewidth=0.5)
>>
>> It all works. However, I saw in the API documentation (and the source)
>> that there is a Circle object in patch. I was hoping that using this
>> rather than polygons would give better quality output and possibly
>> smaller files. Now I can instantiate it
>>
>> circle = Circle((x,y), c[3], facecolor=cmapper.to_rgba(v))
>>
>> but can't work out what to do with it! I've tried
>>
>> ax.add_patch( circle )
>>
>> and also
>>
>> trans = blend_xy_sep_transform( ax.transAxes, ax.transData )
>> circle.set_transform( trans )
>> ax.add_patch( circle )
>>
>> Neither work. Any ideas?
>>
>> Regards,
>>
>> Andrew
>>
>>
From: Stephen G. <ste...@op...> - 2007年07月01日 23:45:09
Hi,
being a newbie myself, .. I don't know if I'm misguiding you. But do 
wonder if you looked at the scatter command
see scatter_demo2.py on
http://matplotlib.sourceforge.net/screenshots.html for an example
It *seems* like it already does what you are trying to do?, maybe I'm 
missing something in my understanding.
Steve
Andrew McLean wrote:
> I'm a new user of matplotlib (athough I have been using both Matlab and
> Python for years).
>
> I have an application where I need to display data as a set of filled
> circles. The centre and the radius of the circles are both specified in
> data coordinates. The data points have an additional scalar attribute,
> which is displayed using a pseudo-colour mapping.
>
> I've hacked something together where the circles are approximated by
> polygons using either the axis fill method or the pylab fill function. I
> select the colour by calling the get_rgba method of a ScalarMappable
> object. In the following code snippet c is a tuple containg the x and y
> coords of the centre of the circle, the radius, and a scalar "value"
>
> theta = arange(numSegs+1) * 2.0 * math.pi / numSegs
> cos_theta = cos(theta)
> sin_theta = sin(theta)
> for c in cart:
> x = c[1] + c[3] * cos_theta
> y = c[2] + c[3] * sin_theta
> v = c[4]
> fill(x, y, facecolor=mapper.to_rgba(v), linewidth=0.5)
>
> It all works. However, I saw in the API documentation (and the source)
> that there is a Circle object in patch. I was hoping that using this
> rather than polygons would give better quality output and possibly
> smaller files. Now I can instantiate it
>
> circle = Circle((x,y), c[3], facecolor=cmapper.to_rgba(v))
>
> but can't work out what to do with it! I've tried
>
> ax.add_patch( circle )
>
> and also
>
> trans = blend_xy_sep_transform( ax.transAxes, ax.transData )
> circle.set_transform( trans )
> ax.add_patch( circle )
>
> Neither work. Any ideas?
>
> Regards,
>
> Andrew
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Andrew M. <and...@an...> - 2007年07月01日 23:20:53
I'm a new user of matplotlib (athough I have been using both Matlab and
Python for years).
I have an application where I need to display data as a set of filled
circles. The centre and the radius of the circles are both specified in
data coordinates. The data points have an additional scalar attribute,
which is displayed using a pseudo-colour mapping.
I've hacked something together where the circles are approximated by
polygons using either the axis fill method or the pylab fill function. I
select the colour by calling the get_rgba method of a ScalarMappable
object. In the following code snippet c is a tuple containg the x and y
coords of the centre of the circle, the radius, and a scalar "value"
theta = arange(numSegs+1) * 2.0 * math.pi / numSegs
cos_theta = cos(theta)
sin_theta = sin(theta)
for c in cart:
 x = c[1] + c[3] * cos_theta
 y = c[2] + c[3] * sin_theta
 v = c[4]
 fill(x, y, facecolor=mapper.to_rgba(v), linewidth=0.5)
It all works. However, I saw in the API documentation (and the source)
that there is a Circle object in patch. I was hoping that using this
rather than polygons would give better quality output and possibly
smaller files. Now I can instantiate it
 circle = Circle((x,y), c[3], facecolor=cmapper.to_rgba(v))
but can't work out what to do with it! I've tried
 ax.add_patch( circle )
and also
 trans = blend_xy_sep_transform( ax.transAxes, ax.transData )
 circle.set_transform( trans )
 ax.add_patch( circle )
Neither work. Any ideas?
Regards,
Andrew
2 messages has been excluded from this view by a project administrator.

Showing results of 219

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