windrose

Polar axis support is embryonic; I don't see an easy way to

    > make a polar bar chart. You could make the bar outlines
    > using "plot" on a polar axis.

Although polar support is patchy, it usually can be made to work. Eg,
it already handles most types of objects (text, lines, collections).
I took a look and noticed that it did not draw it's patches, though it
stores them and handles the transformations properly. This is simply
one line sin of omission (which I've fixed in svn), ie I needed to add
the patches to the list of artists being drawn in PolarAxes.draw.

Here is a little script that shows how to add "rectangles" to polar
plots (requires svn 2258)

from matplotlib.patches import Rectangle
from matplotlib.axes import PolarSubplot
import matplotlib.cm as cm
from pylab import figure, show, nx

dtheta = nx.pi/8
r = 1
theta = 0

fig = figure()
ax = PolarSubplot(fig, 111)
fig.add_axes(ax)
N = 15
for i in range(N):
    frac = float(i)/N
    rect = Rectangle( (theta, 0), dtheta, r, facecolor=cm.jet(frac))
    ax.add_patch(rect)
    theta += dtheta
    r*=1.05
ax.autoscale_view()
show()

Although I don't have experience with windrose plots, this can
probably serve as the foundation. The autoscale view functionality is
clearly off, but it mostly works. One can do the same with arbitrary
patches (eg Polygons), as long as you construct vertices where the
x/width attribute is interpreted as radians, and the y/height
attribute is interpreted as radius.

JDH

John,

Thanks--I thought it should work, but when I tried it and it didn't, I failed to look more closely.

Now a question: is there a reason why the argument order for polar plotting is (theta, r)? In thinking about polar coordinates, I always think of them in the reverse order (r, theta), and I think this is the way I have always seen polar coordinates in math and physics books.

Eric

John Hunter wrote:

···

"Eric" == Eric Firing <efiring@...202...> writes:

    > Polar axis support is embryonic; I don't see an easy way to
    > make a polar bar chart. You could make the bar outlines
    > using "plot" on a polar axis.

Although polar support is patchy, it usually can be made to work. Eg,
it already handles most types of objects (text, lines, collections).
I took a look and noticed that it did not draw it's patches, though it
stores them and handles the transformations properly. This is simply
one line sin of omission (which I've fixed in svn), ie I needed to add
the patches to the list of artists being drawn in PolarAxes.draw.

Here is a little script that shows how to add "rectangles" to polar
plots (requires svn 2258)

from matplotlib.patches import Rectangle
from matplotlib.axes import PolarSubplot
import matplotlib.cm as cm
from pylab import figure, show, nx

dtheta = nx.pi/8
r = 1
theta = 0

fig = figure()
ax = PolarSubplot(fig, 111)
fig.add_axes(ax)
N = 15
for i in range(N):
    frac = float(i)/N
    rect = Rectangle( (theta, 0), dtheta, r, facecolor=cm.jet(frac))
    ax.add_patch(rect)
    theta += dtheta
    r*=1.05
ax.autoscale_view()
show()

Although I don't have experience with windrose plots, this can
probably serve as the foundation. The autoscale view functionality is
clearly off, but it mostly works. One can do the same with arbitrary
patches (eg Polygons), as long as you construct vertices where the
x/width attribute is interpreted as radians, and the y/height
attribute is interpreted as radius.

JDH

Hi,
sorry to ask for that, but I'm not very familiar with matplotlib svn
repository, and after going to sourceforge, I have done a "svn co ..." which
copy all matplotlib branch in a local directory. Now, what do I do? What
files do I have to compile?
Thanks
PS : I have done a very little script with scipy to compute wind frequencies,
but if someone know a dedicated module which do that, I could verify my work.

···

Le Mercredi 05 Avril 2006 07:20, John Hunter a écrit :

    > Polar axis support is embryonic; I don't see an easy way to
    > make a polar bar chart. You could make the bar outlines
    > using "plot" on a polar axis.

Although polar support is patchy, it usually can be made to work. Eg,
it already handles most types of objects (text, lines, collections).
I took a look and noticed that it did not draw it's patches, though it
stores them and handles the transformations properly. This is simply
one line sin of omission (which I've fixed in svn), ie I needed to add
the patches to the list of artists being drawn in PolarAxes.draw.

Here is a little script that shows how to add "rectangles" to polar
plots (requires svn 2258)

from matplotlib.patches import Rectangle
from matplotlib.axes import PolarSubplot
import matplotlib.cm as cm
from pylab import figure, show, nx

dtheta = nx.pi/8
r = 1
theta = 0

fig = figure()
ax = PolarSubplot(fig, 111)
fig.add_axes(ax)
N = 15
for i in range(N):
    frac = float(i)/N
    rect = Rectangle( (theta, 0), dtheta, r, facecolor=cm.jet(frac))
    ax.add_patch(rect)
    theta += dtheta
    r*=1.05
ax.autoscale_view()
show()

Although I don't have experience with windrose plots, this can
probably serve as the foundation. The autoscale view functionality is
clearly off, but it mostly works. One can do the same with arbitrary
patches (eg Polygons), as long as you construct vertices where the
x/width attribute is interpreted as radians, and the y/height
attribute is interpreted as radius.

JDH

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Lionel Roubeyrie - lroubeyrie@...1068...
LIMAIR
http://www.limair.asso.fr

Hi all,
thanks for your help and for polar axes, I've got a good result like you can
see here : http://www.limair.asso.fr/share/windrose.png
If someone is interested by the code, I can send it to him (need scipy for
computing frequencies).
bye

···

--
Lionel Roubeyrie - lroubeyrie@...1068...
LIMAIR
http://www.limair.asso.fr