我试图在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并不对应于theta = 0时的圆角。例如,我的一个点应具有RA = 45.89度,但似乎没有一个点对应于此。

对我做错了什么建议吗?

最佳答案

该图需要弧度。添加以下行并重新绘制会正确显示:

ra  = [x/180.0*3.141593 for x in ra]

关于python - 极坐标图在matplotlib中给出了错误的角度,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27216495/

10-11 02:05