473,473 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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()
Sep 26 '08 #1
3 5227
Bas
I only have experience with the matlab version of polar, but my wild
guess is that you have convert your degrees to radians. Go to the
Matplotlib newsgroup if you need any better help.

HTH,
Bas
Sep 26 '08 #2
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,
Sep 26 '08 #3
On Sep 26, 3:33*pm, afrogazer <justin.k...@gmail.comwrote:
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....
Sep 26 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Hunter | last post by:
matplotlib is a 2D plotting library for python. You can use matplotlib interactively from a python shell or IDE, or embed it in GUI applications (WX, GTK, and Tkinter). matplotlib supports many...
5
by: Enigma Curry | last post by:
I'm playing around with matplotlib for the first time. I'm trying to make a very simple histogram of values 1-6 and how many times they occur in a sequence. However, after about an hour of...
8
by: Andi Clemens | last post by:
Hi, everytime I try to plot a bar with matplotlib I get the following error message: Traceback (most recent call last): File "bar_stacked.py", line 13, in ? p1 = bar(ind, menMeans, width,...
0
by: spross | last post by:
hi all i have to use matplotlib on mac os x. on the official site of matplotlib, i found a link to precompiled python packages for mac os x: http://pythonmac.org/packages/py24-fat/index.html ...
0
by: Soren | last post by:
Hi, I've been trying to embed matplotlib in wxpython. I want to be able to put a figure (axes) in a wx.Panel and place it somewhere in my GUI. The GUI should have other panels with buttons etc....
4
by: Bill Jackson | last post by:
Hi, I'm having some trouble plotting with the following matplotlibrc: text.usetex : True I tried clearing the cache files under ~/.matplotlib, but this did not help the problem. I'd post...
0
by: yadin | last post by:
hi every one can you please can you help me to fix these polar plot in db's so that the center is at the minimun negative number in voltagedb about and the maximun is at zero how can i see...
0
by: Rominsky | last post by:
I am trying to use the fill command to draw a box around an object in an image. I can get the box drawn, but there seems to be a side effect. The fill command is adding white lines to the top and...
9
by: Glenton | last post by:
Hi All I've been knocking my head against this, and wondered if anyone had any insights. I've made a plot with the wonderful matplotlib. I've always found it to work brilliantly, and I've found...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.