我试图在Python中绘制一个右升天 - 倾斜,极坐标图,其中角度表示正确的提升,而半径为偏差,范围在±30之间。
我的代码是
import numpy
import matplotlib.pyplot as pyplot
ra = [345.389547454166689,31.892236646759279,45.893722479722229,93.955296573703706,160.079453957685217,211.154701609814822,256.486559377222193,307.258751710462889,299.691923545370344,340.364168244814834,335.077343971296386,358.126565808425880]
dec = [23.835021447037050,25.218513920000003,27.509148433518519,26.551432991388879,-25.077519630833340,-20.134061982500004,-21.042512836851849,-4.903512838240742,-0.506450475370370,14.280932901944448,19.222101837500002,18.792707990925926]
fig = pyplot.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8],polar=True)
ax.set_ylim(-30,30)
ax.set_yticks(numpy.arange(-30,30,10))
ax.scatter(ra,dec,c ='r')
pyplot.show()
这会生成以下图表:
显然我误解了极坐标图是如何工作的,因为RA与θ= 0的角度不对应。例如,我的一个点应该有RA = 45.89度,但似乎没有任何一点对应于此
关于我做错的任何建议?
答案 0 :(得分:5)
情节需要弧度。添加以下行并重新绘制正确显示:
ra = [x/180.0*3.141593 for x in ra]