0
我有绘出针对经度点的磁通密度的曲线图:标签x轴
但我需要x轴从24.3读 - > 0在中心 - > 335.7
我已经使用matplotlib.ticker设置每30个像素的滴答,相当于每1度。
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
hdulist = fits.open('w1_subtracted_2_deg.fits')
nodisk_data, nodisk_header = hdulist[0].data, hdulist[0].header
x = range(nodisk_data.shape[1])
y = np.sum(nodisk_data, axis = 0)
ax = plt.axes()
ax.xaxis.set_major_locator(ticker.MultipleLocator(300))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(30))
plt.plot(x, y)
plt.title('Longitudinal sum of flux density per steradian')
plt.xlabel(r'Galactic longitude, $\ell$')
plt.ylabel(r'Integrated flux density per steradian, $MJ.sr^{-1}$')
plt.grid(True)
plt.show()
plt.savefig('add_cols.png')
hdulist.close()
有一个简单的命令,我可以用这一点,也许在axes
类,或是否需要进行硬编码的x轴点的列表?或者,也可以将中心像素设置为参考像素,并在圆周的任一方向上绘制标记为24.3度的图?
我会通过首先改变沿x轴的_values_到正确度,然后绘制度值并让蜱是做到这一点自动。 – cphlewis