Polar Plot

Sherif Ahmed wrote:

Hello Eric,

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

It looks like support for the resolution kwarg was added late in January, so you need either a more recent version, or an older version. Unfortunately, it also looks like the latest release was before this change.

Maybe it is time for another release, either 0.98.5 maintenance or trunk. Or both. Releases are not my area, though.

Eric

···

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

Hi Eric,

Thanks agaon. Now it works after updating to matplotlib 98.5.

Well I also attach the code. I find it good if we can publish it to other
interested users. May be some one needs it or likes to upgrade it. I made
already the basic work. How does this work? Should I distribute it via the
list here or somewhere else?

I am not expert in this stuff :slight_smile:

Nice wishes,
Sherif

PlotSmith.py (9.31 KB)

···

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

Sherif Ahmed wrote:

Hello Eric,

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

It looks like support for the resolution kwarg was added late in
January, so you need either a more recent version, or an older version.
  Unfortunately, it also looks like the latest release was before this
change.

Maybe it is time for another release, either 0.98.5 maintenance or
trunk. Or both. Releases are not my area, though.

Eric

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