Polar Plot

Sherif Ahmed wrote:

Hello Mike,

Thanks for your advice. I think this is exactly what I need. I am not sure
how to use this option, might you help me?

I use simply the following lines in my code:

self.figure.clf()
self.axes = self.figure.add_axes([0.1,0.1,0.8,0.8], projection='polar',

     resolution=1,

aspect='equal')

and later:
self.axes.plot(angle(data),abs(data),label=title,linewidth = 2,zorder=10)

Where should I change the resolution feature? With each plot or with figure
object?

Put the resolution kwarg in the call to the add_axes method. The way the line is drawn between points--whether as a straight line on the plot or by interpolating in the data coordinates--is controlled on a per-axes basis by this kwarg when the axes are created.

Eric

Hello Eric,

I am afraid this does not work. I get error saying that :
AttributeError: 'PolarAxes' object has no attribute 'set_resolution'

The full error text is:

···

-----------------------------------------
Traceback (most recent call last):
  File "D:\EmGine
Project\emGine_GUI_0_7_5__11022009\emGine_GUI_0_7_5\emGineGUI\PlotSmith.py",
line 287, in <module>
    PlotSmith.plot_dummy()
  File "D:\EmGine
Project\emGine_GUI_0_7_5__11022009\emGine_GUI_0_7_5\emGineGUI\PlotSmith.py",
line 241, in plot_dummy
    self.plot_data(data1.real, data1.imag,freq1,'my first data')
  File "D:\EmGine
Project\emGine_GUI_0_7_5__11022009\emGine_GUI_0_7_5\emGineGUI\PlotSmith.py",
line 144, in plot_data
    self.axes = self.figure.add_axes([0.1,0.1,0.8,0.8], projection='polar',
resolution = 1, aspect='equal')
  File
"c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplo
tlib\figure.py", line 615, in add_axes
    a = projection_factory(projection, self, rect, **kwargs)
  File
"c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplo
tlib\projections\__init__.py", line 44, in projection_factory
    return get_projection_class(projection)(figure, rect, **kwargs)
  File
"c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplo
tlib\projections\polar.py", line 171, in __init__
    Axes.__init__(self, *args, **kwargs)
  File
"c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplo
tlib\axes.py", line 537, in __init__
    if len(kwargs): martist.setp(self, **kwargs)
  File
"c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplo
tlib\artist.py", line 894, in setp
    func = getattr(o,funcName)
AttributeError: 'PolarAxes' object has no attribute 'set_resolution'

-----------------------------------------

Do you know what is the reason behind this?

Thanks,
Sherif

-----Original Message-----
From: Eric Firing [mailto:efiring@…229…]
Sent: Thursday, March 19, 2009 11:39 PM
To: Sherif Ahmed
Cc: 'Michael Droettboom'; matplotlib-devel@lists.sourceforge.net
Subject: Re: [matplotlib-devel] Polar Plot

Sherif Ahmed wrote:

Hello Mike,

Thanks for your advice. I think this is exactly what I need. I am not sure
how to use this option, might you help me?

I use simply the following lines in my code:

self.figure.clf()
self.axes = self.figure.add_axes([0.1,0.1,0.8,0.8], projection='polar',

     resolution=1,

aspect='equal')

and later:
self.axes.plot(angle(data),abs(data),label=title,linewidth = 2,zorder=10)

Where should I change the resolution feature? With each plot or with

figure

object?

Put the resolution kwarg in the call to the add_axes method. The way
the line is drawn between points--whether as a straight line on the plot
or by interpolating in the data coordinates--is controlled on a per-axes
basis by this kwarg when the axes are created.

Eric