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 results of 498

1 2 3 .. 20 > >> (Page 1 of 20)
From: <pro...@cl...> - 2009年01月31日 21:11:29
>On Sat, Jan 31, 2009 at 5:03 AM, <pro...@cl...> wrote:
>> Hello,
>>
>> I would like to drag points and graphs of functions with the mouse. Is 
there
>> an example somewhere of this kind of functionnality ?
>
>Take a look at the event handling tutorial -- it includes a draggable
>rectangle example
>
>http://matplotlib.sourceforge.net/users/event_handling.html
>
>JDH
Indeed I would like to draw for example a line A-B-C-D where A,B,C and D 
are four points that could be drag.
Is there someone who had done that ?
From: <pro...@cl...> - 2009年01月31日 19:16:22
>On Sat, Jan 31, 2009 at 5:03 AM, <pro...@cl...> wrote:
>> Hello,
>>
>> I would like to drag points and graphs of functions with the mouse. Is 
there
>> an example somewhere of this kind of functionnality ?
>
>Take a look at the event handling tutorial -- it includes a draggable
>rectangle example
>
>http://matplotlib.sourceforge.net/users/event_handling.html
>
>JDH
Thanks for the link.
C.
From: John H. <jd...@gm...> - 2009年01月31日 16:27:33
On Sat, Jan 31, 2009 at 5:03 AM, <pro...@cl...> wrote:
> Hello,
>
> I would like to drag points and graphs of functions with the mouse. Is there
> an example somewhere of this kind of functionnality ?
Take a look at the event handling tutorial -- it includes a draggable
rectangle example
http://matplotlib.sourceforge.net/users/event_handling.html
JDH
From: <pro...@cl...> - 2009年01月31日 11:03:31
<!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 would like to drag points and graphs of functions with the mouse. Is there an&nbsp;example somewhere of this kind of functionnality&nbsp;?</P>
<P>&nbsp;</P>
<P>Christophe.</P></body></html>
Note: Posted to matplotlib-devel and debian-science. 
Sandro, 
 Firstly, good luck with the book. 
The sort of book I'd buy would explain how to use the combination of
matplotlib/ipython/scipy/numpy to analyse data. 
> - what are you using matplotlib for?
I want to use matplotlib/ipython/numpy/scipy for analysis of
experimental data - plotting and fitting models to it. Also perhaps
simulation of the data. 
I have also wanted to use matplotlib to plot data as it was acquired -
see below.
I've not really used matplotlib in anger - but am likely to do so in
the future (and it would have been useful during my PhD had it been
around then).
> - what are the things you like the most of matplotlib, that you want
> to give emphasis to? And why?
Quality plots. The ability to add TeX labels. 
I've been keeping an eye on matplotlib for several years - it looks
good. I really must spend some time exploring it. 
> - what are the (basic) things that, when you were beginning to use
> matplotlib, you wanted to see grouped up but couldn't find?
> - what would you like to see in a book about matplotlib?
Start off by reading data from a file, plotting it and fitting a
function to that data.
Often, several scans are in the same data file. An elegant solution to
reading data something like this example would be useful.
# Scan: 1
# Time: 18:00
# Temperature: 21
# t data
1 12
2 33
3 14
4 40
5 60
# Scan: 2
# Time: 18:02
# Temperature: 30
# t data
1 22
2 33
3 44
4 55
And so on. 
Fitting a function to several data sets - with some of the parameters
fitted to both sets of data and some not would be useful.
> - what are some those advanced feature that made you yell "WOW!!" ?
> - what are the things you'd like to explore of matplotlib and never
> had time to do?
Plotting with related scales
----------------------------
Sometimes it is useful to plot related scales on x1 and x2 axes. I've
come across this several times in different contexts. In its simplest
form, there is a linear relationship between the axes. In a mechanical test, you might want extension on the x1 axis and strain on the x2 axis (for example). 
Sometimes there is not a linear relationship. For example you might
want to plot frequency (or photon energy) on x1 and wavelength on x2.
An even more complex example is a Hall-Petch plot:
(Yield Stress) = k/sqrt(Grain Size)
So plotting 1/Sqrt(Grain Size) on the X1 axis gives a linear
plot, but it would be useful to plot the grain size on the X2 scale. 
ipython and emacs
-----------------
Suppose I want to write a script to analyse some data (perhaps I want
a record of what I've done, or perhaps I'd like to perform the same
analysis on several data sets). I'd probably do so in emacs - but it
is useful to do some experimentation in ipython - tab completion is
particularly useful. I feel there must be a good way to do my
experimentation in ipython and save the important bits in emacs - but
I've not sat down and worked out an efficient way of doing this.
Data aqcuisition and experimental control:
-----------------------------------------
Writing a simple application to acquire data - ideally from multiple
sources and plot the data as it is acquired. In my case I wanted to
combine mechanical with electrical tests. A couple of interesting
articles by G Varoquaux are listed at
http://wiki.debian.org/DebianScience/DataAcquisition
This is perhaps beyond the scope of the book, but it has come up on
the mailing lists a couple of times. The ideal application would have
a gui for simple use, but a command line (probably ipython) for more
more complex use - perhaps performing a series of tests under
different conditions.
Some discussion of plotting non gridded 2d data should also be in
there.
> 
> Your suggestions are really appreciated :) And wish me good luck!
I don't think it is the thrust of your book, but another book I was
looking for is "A cookbook of Numerical simulations of classic
physics/engineering problems". For use by physicists/engineers who
don't want to rewrite things from scratch.
Good luck. 
Chris
From: <And...@gt...> - 2009年01月30日 18:14:54
> -----Original Message-----
> From: And...@gt...
> [mailto:And...@gt...]
> Sent: Friday, January 30, 2009 11:46 AM
> To: jd...@gm...
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] Plot only inside a disc
>
>
>
> > -----Original Message-----
> > From: John Hunter [mailto:jd...@gm...]
> > Sent: Friday, January 30, 2009 11:29 AM
> > To: Henshaw, Andy
> > Cc: mat...@li...
> > Subject: Re: [Matplotlib-users] Plot only inside a disc
> >
> > On Fri, Jan 30, 2009 at 10:27 AM, <And...@gt...>
> > wrote:
> >
> > > Hmm ... this doesn't quite give me what I'm looking for. When I do
> > that, I get a semitransparent circle that is clipped to a rectangle.
> > What I need is a semi-transparent rectangle (with a hole cut out of
> the
> > middle) that overlays the plot. The attached graphic demonstrates
> the
> > concept.
> >
> > It sounds like what you want is a complex path and may not need to
> > muck with clipping at all. Take a look at
> >
> > http://matplotlib.sourceforge.net/examples/api/donut_demo.html
>
Thanks, that is working quite well, now.
From: <And...@gt...> - 2009年01月30日 16:46:10
> -----Original Message-----
> From: John Hunter [mailto:jd...@gm...]
> Sent: Friday, January 30, 2009 11:29 AM
> To: Henshaw, Andy
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] Plot only inside a disc
>
> On Fri, Jan 30, 2009 at 10:27 AM, <And...@gt...>
> wrote:
>
> > Hmm ... this doesn't quite give me what I'm looking for. When I do
> that, I get a semitransparent circle that is clipped to a rectangle.
> What I need is a semi-transparent rectangle (with a hole cut out of the
> middle) that overlays the plot. The attached graphic demonstrates the
> concept.
>
> It sounds like what you want is a complex path and may not need to
> muck with clipping at all. Take a look at
>
> http://matplotlib.sourceforge.net/examples/api/donut_demo.html
Okay, although I wish the clipping was working as I expected, as it looks like it would have been **quite a bit** cleaner. It looks like your svn patch would enable me to do what I want with patches, wouldn't you agree?
From: John H. <jd...@gm...> - 2009年01月30日 16:29:18
On Fri, Jan 30, 2009 at 10:27 AM, <And...@gt...> wrote:
> Hmm ... this doesn't quite give me what I'm looking for. When I do that, I get a semitransparent circle that is clipped to a rectangle. What I need is a semi-transparent rectangle (with a hole cut out of the middle) that overlays the plot. The attached graphic demonstrates the concept.
It sounds like what you want is a complex path and may not need to
muck with clipping at all. Take a look at
http://matplotlib.sourceforge.net/examples/api/donut_demo.html
From: <And...@gt...> - 2009年01月30日 16:27:17
Attachments: temp.png
> -----Original Message-----
> From: John Hunter [mailto:jd...@gm...]
>
> On Fri, Jan 30, 2009 at 8:54 AM, <And...@gt...> wrote:
>
> > This is a very timely question for me. I'm needing to do something
> very similar, but I need to overlay a semi-transparent rectangle with a
> hole cut out of it. So, I'm making a rectangular patch, making a
> circular patch, setting the circular patch as the clip region for the
> rectangular patch, and then adding the clipped patch to the plot.
> However, I seem to be having trouble with the coordinate system, as
> there is no clipping on the rectangle.
> >
> > My test code looks like this:
>
> > r.set_clip_path(cutout)
> > ax.add_patch(r)
> > plt.show()
>
>
> The problem is that the "add_patch" command is setting the clippath to
> the axes bounding box. I just committed a patch on the branch and
> trunk which only sets the clippath to the default if it is not already
> set. If you don't have access to svn, just make the call to
> r.set_clip_path *after* you call ax.add_patch.
>
> JDH
Hmm ... this doesn't quite give me what I'm looking for. When I do that, I get a semitransparent circle that is clipped to a rectangle. What I need is a semi-transparent rectangle (with a hole cut out of the middle) that overlays the plot. The attached graphic demonstrates the concept.
Thanks for the response.
From: John H. <jd...@gm...> - 2009年01月30日 16:12:38
On Fri, Jan 30, 2009 at 8:54 AM, <And...@gt...> wrote:
> This is a very timely question for me. I'm needing to do something very similar, but I need to overlay a semi-transparent rectangle with a hole cut out of it. So, I'm making a rectangular patch, making a circular patch, setting the circular patch as the clip region for the rectangular patch, and then adding the clipped patch to the plot. However, I seem to be having trouble with the coordinate system, as there is no clipping on the rectangle.
>
> My test code looks like this:
> r.set_clip_path(cutout)
> ax.add_patch(r)
> plt.show()
The problem is that the "add_patch" command is setting the clippath to
the axes bounding box. I just committed a patch on the branch and
trunk which only sets the clippath to the default if it is not already
set. If you don't have access to svn, just make the call to
r.set_clip_path *after* you call ax.add_patch.
JDH
From: Eli B. <eb...@gm...> - 2009年01月30日 15:22:21
Hello again,
I finally found the command I was looking for. It is the to_polygons().
Here is what worked :
# make a LineCollection of contours
col=contour(X,Y,Z,LevelsNumber).collections
for i in np.arange(0,LevelsNumber,1):
 polygoni=col[i].get_paths()[0].to_polygons()[0]
 print polygoni
All the vertices in each collections are extracted to the "polygoni".
Thanks again to Jeff and Patrick !
By the way, I found out that I do not actually need this procedure to
achieve may goal
which was to make a contour plot in ternary coordinates.
Eli
On Tue, Jan 27, 2009 at 11:08 PM, Patrick Marsh <pat...@gm...>wrote:
> 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: <And...@gt...> - 2009年01月30日 14:54:27
>>[Christophe] Thanks, your example works but what I must do so to plot for example
y=cos x
>> ? I'm a very beginner.
>
> line, = ax.plot(x, np.cos(x))
> patch = patches.Circle((300,300), radius=100)
> line.set_clip_path(patch)
>
>Everything in the matplotlib figure is an "Artist" (lines, images,
>text, rectangles) and you can set the clippath of any artist. See
>
> http://matplotlib.sourceforge.net/users/artists.html
> http://matplotlib.sourceforge.net/api/artist_api.html
>
>JDH
This is a very timely question for me. I'm needing to do something very similar, but I need to overlay a semi-transparent rectangle with a hole cut out of it. So, I'm making a rectangular patch, making a circular patch, setting the circular patch as the clip region for the rectangular patch, and then adding the clipped patch to the plot. However, I seem to be having trouble with the coordinate system, as there is no clipping on the rectangle.
My test code looks like this:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.path as path
import matplotlib.patches as patches
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.arange(-50,50,0.1)
line, = ax.plot(x, np.cos(x)*50)
r=patches.Rectangle((-10,-10), 20, 20, fc=(0.5,0.5,0.5,0.9))
r.set_zorder(100)
# shouldn't one of these work?
# Plot coordinate system
cutout = patches.Circle((0,0), radius=10)
# Window coordinate system
#~ cutout = patches.Circle((300,300), radius=50)
r.set_clip_path(cutout)
ax.add_patch(r)
plt.show()
From: John H. <jd...@gm...> - 2009年01月30日 12:31:10
On Fri, Jan 30, 2009 at 12:28 AM, jamesf0 <ja...@ut...> wrote:
>
> Sorry, I have done that change, and get these errors:
>
>
> Traceback (most recent call last):
> File "test7.py", line 36, in <module>
> ax=fig.add_subplot(111, polar=True, resolution=1)
> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 676, in
> add_subplot
> a = subplot_class_factory(projection_class)(self, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 6823, in
> __init__
> self._axes_class.__init__(self, fig, self.figbox, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/projections/polar.py",
> line 171, in __init__
> Axes.__init__(self, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 537, in
> __init__
> if len(kwargs): martist.setp(self, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line 894, in
> setp
> func = getattr(o,funcName)
> AttributeError: 'PolarAxesSubplot' object has no attribute 'set_resolution'
What version of mpl are you using? This should be fixed for releases >= 0.98.4
JDH
From: jamesf0 <ja...@ut...> - 2009年01月30日 06:28:18
Sorry, I have done that change, and get these errors:
Traceback (most recent call last):
 File "test7.py", line 36, in <module>
 ax=fig.add_subplot(111, polar=True, resolution=1)
 File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 676, in
add_subplot
 a = subplot_class_factory(projection_class)(self, *args, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 6823, in
__init__
 self._axes_class.__init__(self, fig, self.figbox, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/projections/polar.py",
line 171, in __init__
 Axes.__init__(self, *args, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 537, in
__init__
 if len(kwargs): martist.setp(self, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line 894, in
setp
 func = getattr(o,funcName)
AttributeError: 'PolarAxesSubplot' object has no attribute 'set_resolution'
Jouni K. Seppänen wrote:
> 
> Change this to
> 
> ax=fig.add_subplot(111, polar=True, resolution=1)
> 
> and the resolution will get passed to the PolarAxes instance.
> 
> -- 
> Jouni K. Seppänen
> http://www.iki.fi/jks
> 
-- 
View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21742133.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jouni K. S. <jk...@ik...> - 2009年01月30日 04:58:58
jamesf0 <ja...@ut...> writes:
> Thanks for the help, but I can't quite see where to add the add_axes code.
> Here is the code I have been using to plot, the polar plot is a subplot.
> ax=fig.add_subplot(111, polar=True)
Change this to
 ax=fig.add_subplot(111, polar=True, resolution=1)
and the resolution will get passed to the PolarAxes instance.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Thomas R. <tho...@gm...> - 2009年01月30日 03:43:59
Hi all,
I am trying to do the following to produce a customized contour plot:
1. Create a ContourSet from contour()
2. Retrieve vertex positions from this ContourSet
3. Modify the vertex positions by applying a coordinate transformation
4. Apply the changes to the ContourSet
5. Plot the ContourSet
At the moment, I do:
c = contour(image)
then I can get the vertex positions with
for collection in contours.collections:
	for polygon in collection.get_paths():
		x = polygon.vertices[:,0]
		y = polygon.vertices[:,1]
Then, I can apply mathematical operations to x and y, and replace 
c.collections with a new set of LineCollections. So c now contains an 
updated collections set.
My question is, how do I now plot these modified contours? I 
intuitively tried show(c) and draw(c), but now luck. Since I am a 
beginner at python, this may actually be obvious, but I can't figure 
it out!
I also have a minor problem with:
c = contour(image)
as this will draw the contours straight away onto the image, but I 
don't want this to be the case, as I only want to show the modified 
contours. I am using 'ipython -pylab' to run python, so I am guessing 
that this is something to do with the fact that ipython refreshes the 
plot at each plotting command? Is there an easy fix to prevent that 
in this case?
Thank you for any help!
Thomas
From: jamesf0 <ja...@ut...> - 2009年01月29日 23:56:43
Yeah "trying" to plot sun paths.
I'll be more than happy to share once it's complete.
James.
Timmie wrote:
> 
> Hello,
> 
>>>> I am trying to create a plot that resembles the layout of the chart
>>>> seen
>>>> below:
>>>>
>>>> http://www.nabble.com/file/p21721073/brisbane.png 
> are you actually trying to plot sun path digrams?
> 
> May you share a part of your code once it is completed?
> 
> I'd be very interested in seeing a working example.
> 
> Kind regards,
> Timme
> 
> 
> ------------------------------------------------------------------------------
> 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
> 
> 
-- 
View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21738933.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Tim M. <tim...@gm...> - 2009年01月29日 23:34:10
Hello,
>>> I am trying to create a plot that resembles the layout of the chart seen
>>> below:
>>>
>>> http://www.nabble.com/file/p21721073/brisbane.png 
are you actually trying to plot sun path digrams?
May you share a part of your code once it is completed?
I'd be very interested in seeing a working example.
Kind regards,
Timme
From: jamesf0 <ja...@ut...> - 2009年01月29日 22:59:43
Thanks for the help, but I can't quite see where to add the add_axes code.
Here is the code I have been using to plot, the polar plot is a subplot.
fig=figure()
ax=fig.add_subplot(111, polar=True)
ax.set_xticklabels(["E",45,"N",315,"W",225,"S",135])
ax.set_yticklabels([80,70,60,50,40,30,20,10])
...
ax.plot(az, alt, 'b')
fig.savefig('AzvAlt.png')
show()
Michael Droettboom-3 wrote:
> 
> I'm embarrassed to see that I neglected to document this, but you can 
> pass a "resolution" keyword argument to add_axes which sets the number 
> of points of interpolation between each pair of data points. Set this 
> to 1 to disable interpolation.
> 
> This will be documented shortly.
> 
> Mike
> 
> jamesf0 wrote:
>> Hi,
>>
>> Im having some trouble with this "seemingly" simple task of plotting
>> straight lines/fitted curves on a polar plot.
>>
>> I am trying to create a plot that resembles the layout of the chart seen
>> below:
>>
>> http://www.nabble.com/file/p21721073/brisbane.png 
>>
>>
>>
>> So far I have only been able to plot data like so:
>>
>> http://www.nabble.com/file/p21721073/AzvAlt.png 
>>
>>
>> The blue line should be similar to the bottom line of the first example
>> plot. The line would ultimately be formed by fitting a straight
>> line/curve
>> through the points, instead of the way matplotlib is plotting.
>>
>> I am plotting tuples of values (az and alt), and plotting using:
>>
>>
>> ax.plot(az, alt, 'b')
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> 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
> 
> 
-- 
View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21737964.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2009年01月29日 22:48:05
I'm embarrassed to see that I neglected to document this, but you can 
pass a "resolution" keyword argument to add_axes which sets the number 
of points of interpolation between each pair of data points. Set this 
to 1 to disable interpolation.
This will be documented shortly.
Mike
jamesf0 wrote:
> Hi,
>
> Im having some trouble with this "seemingly" simple task of plotting
> straight lines/fitted curves on a polar plot.
>
> I am trying to create a plot that resembles the layout of the chart seen
> below:
>
> http://www.nabble.com/file/p21721073/brisbane.png 
>
>
>
> So far I have only been able to plot data like so:
>
> http://www.nabble.com/file/p21721073/AzvAlt.png 
>
>
> The blue line should be similar to the bottom line of the first example
> plot. The line would ultimately be formed by fitting a straight line/curve
> through the points, instead of the way matplotlib is plotting.
>
> I am plotting tuples of values (az and alt), and plotting using:
>
>
> ax.plot(az, alt, 'b')
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: <pro...@cl...> - 2009年01月29日 20:05:54
>> Thanks, your example works but what I must do so to plot for example 
y=cos x
>> ? I'm a very beginner.
>
> line, = ax.plot(x, np.cos(x))
> patch = patches.Circle((300,300), radius=100)
> line.set_clip_path(patch)
>
>Everything in the matplotlib figure is an "Artist" (lines, images,
>text, rectangles) and you can set the clippath of any artist. See
>
> http://matplotlib.sourceforge.net/users/artists.html
> http://matplotlib.sourceforge.net/api/artist_api.html
>
>JDH
Thanks a lot ! I'll look more precisely the concept of artist later.
Best regards.
Christophe.
From: Jeff W. <js...@fa...> - 2009年01月29日 19:59:48
Christopher Barker wrote:
> Jeff Whitaker wrote:
>> Chris: Here's a self-contained example of the problem (data file 
>> attached):
>
> yup -- I get the same problem. Interesting, I thought it might be an 
> issue with the 'U' flag creating a difference in byte offset, but 
> that's a unix style file already, so it should make no difference 
> anyway -- weird.
>
> Actually, what's probably happening is that the flags are getting 
> passed in to how python is opening the gzip file itself, in which 
> case, yes, 'U' would, or course, break things.
>
> In the MPL code, is the flag passed on through to either file() or 
> gzip.open() that same way? What I'm getting at is whether it's easy to 
> use 'U' with raw text files and not with gzipped files.
>
> In my grepping of the code (SVN head), I only see gzip.open being 
> called "raw", either with no flags or 'wb', except in mlab.cbook, and 
> I see you (or someone!) already patched that. However, I might suggest:
>
> flag = flag.replace('U','')
>
> instead of:
>
> if flag == 'rU': flag = 'r'
Chris: That's a good idea. Done (r6852).
-Jeff
>
> it case someone passes a U in some other way (not that I know of any 
> other valid way...)
>
>
> Now I wonder if I can find the energy to submit a bug report to Python...
>
> -Chris
>
>
>
>
-- 
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: Christopher B. <Chr...@no...> - 2009年01月29日 19:59:15
getting carried away here...
I took a look at the Python SVN (2.5.4 and 2.6.1) for the gzip lib. I 
see this:
 # guarantee the file is opened in binary mode on platforms
 # that care about that sort of thing
 if mode and 'b' not in mode:
 mode += 'b'
 if fileobj is None:
 fileobj = self.myfileobj = __builtin__.open(filename, mode 
or 'rb')
this is going to break for 'U' == you'll get 'rUb' -- who knowes what 
that means?
now to figure out how to file a ticket...
-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: John H. <jd...@gm...> - 2009年01月29日 19:50:53
On Thu, Jan 29, 2009 at 1:40 PM, <pro...@cl...> wrote:
> Thanks, your example works but what I must do so to plot for example y=cos x
> ? I'm a very beginner.
 line, = ax.plot(x, np.cos(x))
 patch = patches.Circle((300,300), radius=100)
 line.set_clip_path(patch)
Everything in the matplotlib figure is an "Artist" (lines, images,
text, rectangles) and you can set the clippath of any artist. See
 http://matplotlib.sourceforge.net/users/artists.html
 http://matplotlib.sourceforge.net/api/artist_api.html
JDH
From: Christopher B. <Chr...@no...> - 2009年01月29日 19:48:55
Jeff Whitaker wrote:
> Chris: Here's a self-contained example of the problem (data file 
> attached):
yup -- I get the same problem. Interesting, I thought it might be an 
issue with the 'U' flag creating a difference in byte offset, but that's 
a unix style file already, so it should make no difference anyway -- weird.
Actually, what's probably happening is that the flags are getting passed 
in to how python is opening the gzip file itself, in which case, yes, 
'U' would, or course, break things.
In the MPL code, is the flag passed on through to either file() or 
gzip.open() that same way? What I'm getting at is whether it's easy to 
use 'U' with raw text files and not with gzipped files.
In my grepping of the code (SVN head), I only see gzip.open being called 
"raw", either with no flags or 'wb', except in mlab.cbook, and I see you 
(or someone!) already patched that. However, I might suggest:
flag = flag.replace('U','')
instead of:
if flag == 'rU': flag = 'r'
it case someone passes a U in some other way (not that I know of any 
other valid way...)
Now I wonder if I can find the energy to submit a bug report to Python...
-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...
2 messages has been excluded from this view by a project administrator.

Showing results of 498

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