SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: jamesf0 <ja...@ut...> - 2009年01月29日 05:21:07
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')
-- 
View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21721073.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年01月29日 18:36:48
I don't see any elegant way to do that.
The easiest way I can think of is to use a derived line2d class.
Something like below will work. Others may have better ideas.
import matplotlib.lines
class Line2DNoInterpolation(matplotlib.lines.Line2D):
 def recache(self):
 matplotlib.lines.Line2D.recache(self)
 self._transformed_path.get_transformed_path_and_affine = \
 self._transformed_path.get_transformed_points_and_affine
ax = subplot(111, projection="polar")
r = np.arange(0, 1.0, 0.1)
theta = 2*np.pi*r
p2 = Line2DNoInterpolation(theta, r, color='r', lw=1)
ax.add_line(p2)
-JJ
On Thu, Jan 29, 2009 at 12:20 AM, jamesf0 <ja...@ut...> 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')
> --
> View this message in context: http://www.nabble.com/How-to-plot-straight-lines-on-polar-plots-tp21721073p21721073.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> 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: 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: 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: 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日 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: 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: 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: 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
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 によって変換されたページ (->オリジナル) /