2017-09-26 2 views
0

でIは経度点に対する磁束密度をプロットしたグラフである:ラベル度

enter image description here

を私は24.3から読み取るために、x軸が必要 - 中心に> 0 - > 335.7

matplotlib.tickerを使用して、1度ごとに30ピクセルごとに目盛りを設定しました。

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度のプロットを付けることができますか?

+2

を自動。 – cphlewis

答えて

0

私はこのようなX軸のラベルの固定:私は最初の正しい度にx軸に沿っ_values_を変更し、その後度値をプロットし、ダニがあることせることによってこれを行うであろう

xticks = [0, 183, 365, 547, 729, 912, 1095, 1277, 1459] 
long_marks = [24, 18, 12, 6, 0, 354, 348, 342, 335] 
ax = plt.axes() 
ax.set_xticks(xticks) 
ax.set_xticklabels(long_marks) 
関連する問題