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

Showing 22 results of 22

From: John H. <jd...@gm...> - 2009年01月28日 20:53:18
On Wed, Jan 28, 2009 at 9:42 AM, Rob Hetland <he...@ta...> wrote:
>
> On Jan 27, 2009, at 1:02 PM, Eric Firing wrote:
>
>> Setting
>> mfc to "none" is what turns off the filling.
>
> As a slightly off-topic question, is there a reason that the argument
> is the string 'none' instead of a normal python None?
None means use the rc param, so it is overloaded here. Not
particularly elegant, but None was already in use for all the line
properties and we needed some way to specify unfilled.
From: John H. <jd...@gm...> - 2009年01月28日 20:39:51
On Wed, Jan 28, 2009 at 2:11 PM, Christopher Barker
<Chr...@no...> wrote:
> But why the heck not? and according to the OP, Excel does create such files.
>
> Personally, I try to ALWAYS use 'U' when opening text files -- it can
> save headaches, and I see no downside. It really should be the default
> -- it's not, because the default was always text, but that was the same
> as binary on *nix -- so there is a lot of *nix code out there opening
> binary files without the 'b' flag. So we couldn't change the default
> back in 2002, it would have broken a LOT of code.
Fair enough -- changed on the trunk in r6845
JDH
From: Christopher B. <Chr...@no...> - 2009年01月28日 20:11:31
John Hunter wrote:
> On Mon, Jan 26, 2009 at 1:10 PM, Christopher Barker
>> Shouldn't csv2rec open files in Universal mode by default anyway?
> 
> The only down side I can see to this is universal support can be
> disabled at build time, though it is on by default. At least this is
> my interpretation of
> 
> http://www.python.org/dev/peps/pep-0278/
well, that was 7 years ago (wow!), I don't know if anyone turns it off 
now, but in any case, so what? it'll act like it does now ( open() 
ignores flags it doesn't understand -- at least it did )
> It's a pretty rare bug (in my experience and I work on linux, unix and
> os x and freqeuently with excel files) with an easy workaround (pass
> in your own file handle) so I am not sure we need a fix here.
But why the heck not? and according to the OP, Excel does create such files.
Personally, I try to ALWAYS use 'U' when opening text files -- it can 
save headaches, and I see no downside. It really should be the default 
-- it's not, because the default was always text, but that was the same 
as binary on *nix -- so there is a lot of *nix code out there opening 
binary files without the 'b' flag. So we couldn't change the default 
back in 2002, it would have broken a LOT of code.
-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: Rob H. <he...@ta...> - 2009年01月28日 19:04:07
On Jan 28, 2009, at 8:26 AM, pro...@cl... wrote:
> I'm looking a solution for ploting relation like f(x;y)=0.
I usually just contour the function over the region. E.g.,
 >>> import numpy as np
 >>> import matplotlib.pyplot as plt
 >>> x, y = mgrid[-10:10:50j, -10:10:50j]
 >>> f = x**3 * y - 3.0
 >>> contour(x, y, f, (0,))
The fourth argument to contour is a list of contours to plot, here 
only zero.
-Rob
----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331
From: Rob H. <he...@ta...> - 2009年01月28日 19:04:07
On Jan 27, 2009, at 1:02 PM, Eric Firing wrote:
> Setting
> mfc to "none" is what turns off the filling.
As a slightly off-topic question, is there a reason that the argument 
is the string 'none' instead of a normal python None?
-Rob
----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331
From: João L. S. <js...@fc...> - 2009年01月28日 18:20:43
Mostafa Razavi wrote:
 > Basically, my problem is that there are a set of points given and I
> should calculate and draw a cubic spline that interpolates them. My 
> instructor has suggested using Matlab, but I don't have it, and I don't 
> know how to use it. Besides, I always prefer Python, if possible. Any 
> ideas?
Read this:
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
From: Mostafa R. <mo...@se...> - 2009年01月28日 18:00:15
John Hunter wrote:
> On Tue, Jan 27, 2009 at 12:44 PM, Mostafa Razavi <mo...@se...> wrote:
> 
>> At http://www.scipy.org/Cookbook/Matplotlib/SigmoidalFunctions I read
>> that matplotlib supports drawing arbitrary paths with splines, but the
>> functionality hasn't been exposed to the user. Can anyone tell me how I
>> can use this functionality? I tried searching the source code for
>> "spline," but I couldn't find anything useful.
>>
>> (Sorry if this has been already brought up. I tried to search the
>> archives but, weirdly enough, I couldn't find any search functionality.
>> Perhaps it hasn't been exposed to the user, yet!)
>>
>> 
>
> This is lightly documented, so no worries. See the following examples
>
> http://matplotlib.sourceforge.net/examples/api/path_patch_demo.html
> http://matplotlib.sourceforge.net/examples/event_handling/path_editor.html
> http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html
>
> and the docs for the path module
>
> http://matplotlib.sourceforge.net/api/path_api.html
>
> JDH
> 
If I've got it right, the path class represents a set of bezier curves. 
This is not exactly what I was looking for. Bezier splines and ordinary 
polynomial splines are essentially the same thing, of course, but I'd 
rather find a way to use the latter so that I won't have to do 
unnecessary conversions.
Basically, my problem is that there are a set of points given and I 
should calculate and draw a cubic spline that interpolates them. My 
instructor has suggested using Matlab, but I don't have it, and I don't 
know how to use it. Besides, I always prefer Python, if possible. Any 
ideas?
From: Jae-Joon L. <lee...@gm...> - 2009年01月28日 17:22:06
This is a bug introduced in the recent version of MPL.
While it is fixed in the maintenance branch, there is no release yet.
You may
 1) try the svn version
or
 2) apply the patch by yourself.
 http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_98_5_maint/lib/matplotlib/legend.py?r1=6685&r2=6818&diff_format=u
or
 3) use previous release of mpl (0.95 and before)
or
 4) draw a line (using plot() command) with same line characteristic
outside the axes area and use this line for the legend.
Regards,
 -JJ
On Wed, Jan 28, 2009 at 10:05 AM, Nitin Bhide <nit...@ya...> wrote:
> Hi,
>
> I am unable to create legend for vlines graph. I have modified the vline_demo.py to demonstrate the problem (see below)
> ------------------------------------------------------------
> #!/usr/bin/env python
> from matplotlib.pyplot import *
> from numpy import sin, exp, absolute, pi, arange
> from numpy.random import normal
>
> def f(t):
> s1 = sin(2*pi*t)
> e1 = exp(-t)
> return absolute((s1*e1))+.05
>
> t = arange(0.0, 5.0, 0.1)
> s = f(t)
> nse = normal(0.0, 0.3, t.shape) * s
>
> #plot(t, s+nse, 'b^')
> vlines(t, [0], s, label='vline demo')
> ##Legend creation addedin the demo
> legend()
> ##Legend creation addedin the demo
> xlabel('time (s)')
> title('Comparison of model with data')
> show()
> ------------------------------------------------------------
> I am getting following error stack
>
> ## File "\ActivePython25\Lib\site-packages\matplotlib\figure.py", line 772, in draw
> ## for a in self.axes: a.draw(renderer)
> ## File "\ActivePython25\Lib\site-packages\matplotlib\axes.py", line 1601, in draw
> ## a.draw(renderer)
> ## File "\ACTIVE~1\lib\site-packages\matplotlib\legend.py", line 316, in draw
> ## self._update_legend_box(renderer)
> ## File "\ACTIVE~1\lib\site-packages\matplotlib\legend.py", line 626, in _update_legend_box
> ## legline_marker = legline._legmarker
> ##AttributeError: 'Line2D' object has no attribute '_legmarker'
>
> Do I have to do something specific to get the legend for vlines graph ?
>
> regards,
> Nitin
>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: rmber <rya...@gm...> - 2009年01月28日 16:57:46
I'd like to make a mesh plot that has colors in it and a countor plot below
it just like in matlab's meshc function. Is there a builtin function that
does this, or how could I go about doing it from scratch?
Thanks,
Ryan
-- 
View this message in context: http://www.nabble.com/matplotlib-equivalent-to-MATLAB-meshc--tp21709817p21709817.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jeremy C. <jer...@gm...> - 2009年01月28日 16:55:29
I installed EPD and now would like to install the latest version of
matplotlib so I can try out the new CocoaAgg background. I can download the
binary mpkg from sourceforge, but it won't work for me because my python
version isn't the python from python.org. Can someone help me get this
installed?
Mac OS 10.5.6
EPD with Py2.5 (4.0.30002 ) -- http://www.enthought.com/epd
Thanks,
Jeremy
From: Oscar ¿? <pi...@ho...> - 2009年01月28日 16:24:58
Hi folks,
I have a problem when I use the command "show" in matplotlib. I have this code (campo is a matrix of float numbers):
 from matplotlib.pyplot import figure, show, savefig
 from matplotlib import cm, colors
 fig=figure()
 a=fig.add_subplot(111)
 a.pcolormesh(vx,vz,campo)
 show()
The first time that I run the code, there isn ́t any problem but when I run the code twice, I can ́t close the figure and Python give me this error message:
 "RunTime Error!
 This application has requested the RunTime to terminate it in an unusual way. Please contact the application ́s support team for more information."
Somebody can help me?
Thank you in advance at all.
Oscar
Public University of Navarra.
_________________________________________________________________
Llévate Messenger en tu móvil allá donde vayas ¿A qué esperas?
http://serviciosmoviles.es.msn.com/ 
From: Nitin B. <nit...@ya...> - 2009年01月28日 15:05:37
Hi,
I am unable to create legend for vlines graph. I have modified the vline_demo.py to demonstrate the problem (see below)
------------------------------------------------------------
#!/usr/bin/env python
from matplotlib.pyplot import *
from numpy import sin, exp, absolute, pi, arange
from numpy.random import normal
def f(t):
 s1 = sin(2*pi*t)
 e1 = exp(-t)
 return absolute((s1*e1))+.05
t = arange(0.0, 5.0, 0.1)
s = f(t)
nse = normal(0.0, 0.3, t.shape) * s
#plot(t, s+nse, 'b^')
vlines(t, [0], s, label='vline demo')
##Legend creation addedin the demo
legend()
##Legend creation addedin the demo
xlabel('time (s)')
title('Comparison of model with data')
show()
------------------------------------------------------------
I am getting following error stack
## File "\ActivePython25\Lib\site-packages\matplotlib\figure.py", line 772, in draw
## for a in self.axes: a.draw(renderer)
## File "\ActivePython25\Lib\site-packages\matplotlib\axes.py", line 1601, in draw
## a.draw(renderer)
## File "\ACTIVE~1\lib\site-packages\matplotlib\legend.py", line 316, in draw
## self._update_legend_box(renderer)
## File "\ACTIVE~1\lib\site-packages\matplotlib\legend.py", line 626, in _update_legend_box
## legline_marker = legline._legmarker
##AttributeError: 'Line2D' object has no attribute '_legmarker'
Do I have to do something specific to get the legend for vlines graph ?
regards,
Nitin
 
From: <pro...@cl...> - 2009年01月28日 14:26:34
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Flashmail</title>
<style type="text/css">
BODY, TABLE, TR, TD, P {margin:0;padding:0;}
BODY {background:#FFFFFF;}
</style>
</head>
<body>
<P>Hello,</P>
<P>I'm looking a solution for ploting relation like f(x;y)=0.</P>
<P>&nbsp;</P>
<P>Best regards.</P>
<P>Christophe.</P></body></html>
From: John H. <jd...@gm...> - 2009年01月28日 12:35:55
On Tue, Jan 27, 2009 at 11:00 PM, C M <cmp...@gm...> wrote:
> I don't think there is a built-in way to do this, but
> I thought I'd check first. Can matplotlib (somehow)
> directly plot a duration of time, such as in the form:
> 0:01:39.983001 (h:m:s:microsec)
In general, you must first convert your data to floating point (eg
seconds) and then plot that. There is a way of registering custom
types to automate the conversions and axis formatting, however , so it
can be done. This is how we support plotting of python datetime
objects. See for example
 http://matplotlib.sourceforge.net/examples/units/date_converter.html
 http://matplotlib.sourceforge.net/examples/units/date_support.html
and the matplotlib.units module
JDH
From: John H. <jd...@gm...> - 2009年01月28日 12:30:57
On Wed, Jan 28, 2009 at 3:05 AM, dikshie <di...@gm...> wrote:
> hi,
> does matplotlib support tgif?
No, you can see a list of outputs at
 http://matplotlib.sourceforge.net/faq/installing_faq.html#backends
JDH
From: Jeff W. <js...@fa...> - 2009年01月28日 12:29:21
dikshie wrote:
> hi,
> does matplotlib support tgif?
>
>
> with best regards,
> 
I had to google tgif to find out that it is the file format output by 
the tgif drawing program 
(http://bourbon.usc.edu:8001/tgif/current.html). It is not an image 
format, and matplotlib cannot read or write it.
If you mean gif, the answer is still no, although you can easily convert 
from png to gif using PIL.
-Jeff
From: dikshie <di...@gm...> - 2009年01月28日 09:05:35
hi,
does matplotlib support tgif?
with best regards,
-- 
-dikshie-
From: C M <cmp...@gm...> - 2009年01月28日 05:00:10
I don't think there is a built-in way to do this, but
I thought I'd check first. Can matplotlib (somehow)
directly plot a duration of time, such as in the form:
0:01:39.983001 (h:m:s:microsec)
Thanks,
Che
From: Patrick M. <pat...@gm...> - 2009年01月28日 04:09:09
On Tue, Jan 27, 2009 at 7:16 PM, Eli Brosh <eb...@gm...> wrote:
> Many thanks to Jeff and to Patric !
> I will try to work along the line suggested by Jeff.
> Patric, please send me your code.
> I hope to learn from it.
>
> Thanks again,
> Eli
Here is a template that can be used. I use this for meteorological
models, but should work with any gridded file.
import numpy as np
from mpl_toolkits.basemap import Basemap
f = (some gridded file)
X = np.array(grab longitudes from f)
Y = np.array(grab latitudes from f)
field = np.array(grab field to be contoured from f)
map = Basemap(make a Basemap call here)
level = np.arange(minval, maxval, interval)
col = map.contour(X, Y, field, level).collections
for vertex in col[i].get_paths(): # GET THE PATHS FOR THE EACH
CONTOUR BY LOOPING THROUGH CONTOURS
 for vertex in xy.vertices: # ITERATE OVER THE PATH OBJECTS
 x, y = map(vertex[0],vertex[1],inverse=True) # vertex[0]
and now 'x' is the longitude of the vertex and vertex[1] and now 'y'
is the latitude of the vertex
Let me know how this works.
-Patrick
>
> On Tue, Jan 27, 2009 at 7:09 PM, Patrick Marsh <pat...@gm...>
> wrote:
>>
>> On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker <js...@fa...> wrote:
>> > Eli Brosh wrote:
>> >> Hello,
>> >> I am trying to extract the coordinates of contour lines.
>> >> I tried the following:
>> >>
>> >> cs = *contour*(Z)
>> >> for lev, col in zip(cs.levels, cs.collections):
>> >> s = col._segments
>> >>
>> >> that I found in a previous post (title "contouring", by Jose
>> >> Gómez-Dans-2 <http://www.nabble.com/user/UserProfile.jtp?user=30071>
>> >> Nov 30, 2007; 07:47am ) .
>> >>
>> >> I hoped that s will be a list of numpy arrays, each containing the
>> >> (x,y) vertices
>> >> defining a contour line at level lev.
>> >> However, I got an error message:
>> >> AttributeError: 'LineCollection' object has no attribute '_segments'
>> >>
>> >>
>> >> How is it possible to get coordinates of the contours, similar to the
>> >> MATLAB command
>> >> [C,H] = *CONTOUR*(...)
>> >> where the result in C is the coordinates of the contours.
>> >>
>> >> A similar question appeared in a post "contour data" (by Albert Swart
>> >> <http://www.nabble.com/user/UserProfile.jtp?user=382945> May 17, 2006;
>> >> 09:42am) but I could not understand the answer.
>> >> Is it possible to get more specific directions with a simple example ?
>> >>
>> >>
>> >> Thanks
>> >> Eli
>> > Eli: Calling get_paths() on each line collection in CS.collections will
>> > return a list of Path objects. From the Path objects, you can get a Nx2
>> > array of vertices from the "vertices" attribute. There are no examples
>> > that I know of, but if you get it to do what you want to do, it would be
>> > great if you could contribute an example. As you noted, this question
>> > has come up several times before.
>> >
>> > -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
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > This SF.net email is sponsored by:
>> > SourcForge Community
>> > SourceForge wants to tell your story.
>> > http://p.sf.net/sfu/sf-spreadtheword
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>>
>> I'm not sure if this is entirely what you (Eli) are looking for, but I
>> have code that will contour model data on a map and then extract the
>> lat,lon pairs of all the vertices. If this is what you are looking
>> for, I'm happy to share what I've done.
>>
>> -Patrick
>>
>> --
>> Patrick Marsh
>> Graduate Research Assistant
>> School of Meteorology
>> University of Oklahoma
>> http://www.patricktmarsh.com
>
>
-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com
From: John H. <jd...@gm...> - 2009年01月28日 04:00:20
On Tue, Jan 27, 2009 at 12:44 PM, Mostafa Razavi <mo...@se...> wrote:
> At http://www.scipy.org/Cookbook/Matplotlib/SigmoidalFunctions I read
> that matplotlib supports drawing arbitrary paths with splines, but the
> functionality hasn't been exposed to the user. Can anyone tell me how I
> can use this functionality? I tried searching the source code for
> "spline," but I couldn't find anything useful.
>
> (Sorry if this has been already brought up. I tried to search the
> archives but, weirdly enough, I couldn't find any search functionality.
> Perhaps it hasn't been exposed to the user, yet!)
>
This is lightly documented, so no worries. See the following examples
 http://matplotlib.sourceforge.net/examples/api/path_patch_demo.html
 http://matplotlib.sourceforge.net/examples/event_handling/path_editor.html
 http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html
and the docs for the path module
 http://matplotlib.sourceforge.net/api/path_api.html
JDH
From: Eli B. <eb...@gm...> - 2009年01月28日 01:16:11
Many thanks to Jeff and to Patric !
I will try to work along the line suggested by Jeff.
Patric, please send me your code.
I hope to learn from it.
Thanks again,
Eli
On Tue, Jan 27, 2009 at 7:09 PM, Patrick Marsh <pat...@gm...>wrote:
> On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker <js...@fa...> wrote:
> > Eli Brosh wrote:
> >> Hello,
> >> I am trying to extract the coordinates of contour lines.
> >> I tried the following:
> >>
> >> cs = *contour*(Z)
> >> for lev, col in zip(cs.levels, cs.collections):
> >> s = col._segments
> >>
> >> that I found in a previous post (title "contouring", by Jose
> >> Gómez-Dans-2 <http://www.nabble.com/user/UserProfile.jtp?user=30071>
> >> Nov 30, 2007; 07:47am ) .
> >>
> >> I hoped that s will be a list of numpy arrays, each containing the
> >> (x,y) vertices
> >> defining a contour line at level lev.
> >> However, I got an error message:
> >> AttributeError: 'LineCollection' object has no attribute '_segments'
> >>
> >>
> >> How is it possible to get coordinates of the contours, similar to the
> >> MATLAB command
> >> [C,H] = *CONTOUR*(...)
> >> where the result in C is the coordinates of the contours.
> >>
> >> A similar question appeared in a post "contour data" (by Albert Swart
> >> <http://www.nabble.com/user/UserProfile.jtp?user=382945> May 17, 2006;
> >> 09:42am) but I could not understand the answer.
> >> Is it possible to get more specific directions with a simple example ?
> >>
> >>
> >> Thanks
> >> Eli
> > Eli: Calling get_paths() on each line collection in CS.collections will
> > return a list of Path objects. From the Path objects, you can get a Nx2
> > array of vertices from the "vertices" attribute. There are no examples
> > that I know of, but if you get it to do what you want to do, it would be
> > great if you could contribute an example. As you noted, this question
> > has come up several times before.
> >
> > -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
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by:
> > SourcForge Community
> > SourceForge wants to tell your story.
> > http://p.sf.net/sfu/sf-spreadtheword
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
> I'm not sure if this is entirely what you (Eli) are looking for, but I
> have code that will contour model data on a map and then extract the
> lat,lon pairs of all the vertices. If this is what you are looking
> for, I'm happy to share what I've done.
>
> -Patrick
>
> --
> Patrick Marsh
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> http://www.patricktmarsh.com
>
From: Patrick M. <pat...@gm...> - 2009年01月28日 00:09:27
On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker <js...@fa...> wrote:
> Eli Brosh wrote:
>> Hello,
>> I am trying to extract the coordinates of contour lines.
>> I tried the following:
>>
>> cs = *contour*(Z)
>> for lev, col in zip(cs.levels, cs.collections):
>> s = col._segments
>>
>> that I found in a previous post (title "contouring", by Jose
>> Gómez-Dans-2 <http://www.nabble.com/user/UserProfile.jtp?user=30071>
>> Nov 30, 2007; 07:47am ) .
>>
>> I hoped that s will be a list of numpy arrays, each containing the
>> (x,y) vertices
>> defining a contour line at level lev.
>> However, I got an error message:
>> AttributeError: 'LineCollection' object has no attribute '_segments'
>>
>>
>> How is it possible to get coordinates of the contours, similar to the
>> MATLAB command
>> [C,H] = *CONTOUR*(...)
>> where the result in C is the coordinates of the contours.
>>
>> A similar question appeared in a post "contour data" (by Albert Swart
>> <http://www.nabble.com/user/UserProfile.jtp?user=382945> May 17, 2006;
>> 09:42am) but I could not understand the answer.
>> Is it possible to get more specific directions with a simple example ?
>>
>>
>> Thanks
>> Eli
> Eli: Calling get_paths() on each line collection in CS.collections will
> return a list of Path objects. From the Path objects, you can get a Nx2
> array of vertices from the "vertices" attribute. There are no examples
> that I know of, but if you get it to do what you want to do, it would be
> great if you could contribute an example. As you noted, this question
> has come up several times before.
>
> -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
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
I'm not sure if this is entirely what you (Eli) are looking for, but I
have code that will contour model data on a map and then extract the
lat,lon pairs of all the vertices. If this is what you are looking
for, I'm happy to share what I've done.
-Patrick
-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

Showing 22 results of 22

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