Matplotlib Polar Plot Angles/Axes
I am creating a wind rose using a polar bar plot bu the points do not
seem to align to the correct angles. Here is the sample code I am
using. I can't seem to see anything in the API on how to set the
angles.
Any ideas anybody?
Thanks.
from pylab import *
angles = arange(0,360,45)
data = [18, 11, 11, 17, 39, 43, 25, 9]
fig = figure(figsize=(8,8))
title('Wind Speed/Direction Frequency.', fontsize=13)
ax = fig.add_subplot(111)
fig.add_axes(([0.15,0.15,0.725,0.725]), polar=True)
labels = arange(0,360,22.5)
lines = arange(0,360,22.5)
ax.axis('off')
bar(angles, data, alpha=0.75, align='center', linewidth=0)
show()
--
http://mail.python.org/mailman/listinfo/python-list
Re: Matplotlib Polar Plot Angles/Axes
In my rush I seem to have overlooked that, maybe because it's Friday afternoon. Converting the degrees to radians fixed it: rad_angles = [elem*(pi/180) for elem in angles] Thanks, -- http://mail.python.org/mailman/listinfo/python-list
Re: Matplotlib Polar Plot Angles/Axes
On Sep 26, 3:33 pm, afrogazer <[EMAIL PROTECTED]> wrote: > In my rush I seem to have overlooked that, maybe because it's Friday > afternoon. Converting the degrees to radians fixed it: > > rad_angles = [elem*(pi/180) for elem in angles] > > Thanks, One other caveat, some of the bars may over-lap. To prevent this, the width can be set by converting it to radians too: w = 45*pi/180 bar(angles, data, alpha=0.75, align='center', width=w, linewidth=0) Now onto plotting clockwise with North(0 deg.) on top -- http://mail.python.org/mailman/listinfo/python-list
Re: Matplotlib Polar Plot Angles/Axes
On Sep 26, 4:42 pm, Bas <[EMAIL PROTECTED]> wrote: > On Sep 26, 10:33 pm, afrogazer <[EMAIL PROTECTED]> wrote:> rad_angles = > [elem*(pi/180) for elem in angles] > > You are missing some more on a friday afternoon: angles is created by > arange, so it is a numpy array. In that case you simply can do > rad_angles = pi/180 * angles > No need to use list-comprehensions, that is the whole idea about using > these kick-ass objects! > > Bas Thanks! Should have thought of that, Fridays are a drag. -- http://mail.python.org/mailman/listinfo/python-list
Re: Web programming in Python.
Not to be a condescending, but there are a lot of manuals out there on how to do this and asking on a forum would really not be the best way to get started. Do some research and some reading and you should be up and running in a short time. You can ask questions on the forum if you have difficulties while/after reading. Good luck -- http://mail.python.org/mailman/listinfo/python-list
Matplotlib Polar Plot Clockwise
I have been playing with this for a couple days now and there doesn't seem to be any easy way to fix this except manipulating the data, which is undesirable. It would be some much better if there was a setting in matplotlibrc to choose to plot clockwise or counter- clockwise and the position on 0° I am now trying the transformations, but it looks just too complicated. Anybody ever ran into this. Thanks, Justin. -- http://mail.python.org/mailman/listinfo/python-list
