Reputation: 23
I have plotted a wedge-diagram, but can not seem to figure out how to get labels on the axis and units on the values. The r-axis has to be Dec and the theta-axis has to be RA, both with units of degrees.
Here is my code, hope you can help:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
theta = (np.pi/180)*np.array([340.555906,3.592373,32.473440,33.171584,35.463857,44.268397,339.362504,345.211906,346.485567,346.811945,348.672405,349.180736,349.370850,353.098343])
r = np.array([-32.906663,-33.842402,-32.425917,-32.677975, -30.701083,-31.460307,-32.909861,-30.802969,-33.683759,-32.207783,-33.068686,-33.820102,-31.438195,-31.920375])
colors = 'black'
fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
c = ax.scatter(theta, r,marker='.', c=colors, cmap='hsv', alpha=0.75)
ax.set_thetamin(55)
ax.set_thetamax(-45)
fmt = lambda x, pos: "{:g}".format(np.degrees(x if x >= 0 else x + 2 * np.pi))
ax.xaxis.set_major_formatter(ticker.FuncFormatter(fmt))
plt.show()
EDIT: I have tried setting the lables with:
ax.text(0,-29.9,s='RA')
ax.text(2,-29.5,s='Dec')
Which sort of works, but I can still not get units (degrees) on my values. I think the problem might have something to do with my limits, which has to go around zero, but I am not sure.
Upvotes: 2
Views: 525