Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting theta-ticks in matplotlib polar plots

My question is related to the following: Scatter polar plot in matlab

I tried looking online but couldn't find any with this axis; instead of the polar plot going 0 to 360 degrees how can I do -180 to 180 instead?

like image 912
Steve Grafton Avatar asked Jan 23 '14 17:01

Steve Grafton


1 Answers

After creating the polar axis, you can simply set the ticks. Note that you have to set the ticks in radians and matplotlib will display in degrees.

Not quite sure how you want to deal the discrepancy at 180 and -180.

import matplotlib.pyplot as plt
fig, ax1 = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))
ax1.set_xticks(np.pi/180. * np.linspace(180,  -180, 8, endpoint=False))

polar axis

like image 116
Paul H Avatar answered Sep 17 '22 23:09

Paul H