0

pythonパッケージmatplotlib.imshowを使用して、対応する世界座標系の値、またはおそらく赤経または赤緯を、物理的なピクセル値ではなくxおよびy値としてプロットする方法を誰かが知っているかどうか疑問に思っていました。このページのプロット: http://astroplotlib.stsci.edu/page_images.htm

残念ながら、提供されているスクリプトは IDL です...私はまだ熟達していません...

gridspec レイアウトの概要を説明すると、おそらく役立つでしょう。

fig = pyplot.figure(figsize=(11,11))

gridspec_layout = gridspec.GridSpec(3,3)
gridspec_layout.update(hspace=0.0, wspace=0.0)

hdulist_org_M33_UVM2 = fits.open('myfits.fits')
wcs = WCS(hdulist_org_M33_UVM2[0].header)

pyplot_2 = fig.add_subplot(gridspec_layout[2])

ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], wcs=wcs)

pyplot_2.add_axes(ax)

しかし、運が悪かった。

どうもありがとう。

4

1 に答える 1

0

1 つの解決策は、subplotパラメータ toFITSFigureを使用して、グリッドスペックから境界を取得することです。

次の行に沿ったもの:

from matplotlib import pyplot
from matplotlib import gridspec
import aplpy

fig = pyplot.figure(figsize=(11, 11))
gridspec_layout = gridspec.GridSpec(3, 3)
gridspec_layout.update(hspace=0.0, wspace=0.0)
axes = fig.add_subplot(gridspec_layout[2])
m33 = aplpy.FITSFigure('wfpcii.fits', figure=fig,
                       subplot=list(gridspec_layout[2].get_position(fig).bounds),
                       # dimensions and slices are not normally necessary;
                       # my test-figure has 3 axes
                       dimensions=[0, 1], slices=[0])
print(dir(gridspec_layout[2]))
print(gridspec_layout[2].get_position(fig).bounds)
m33.show_colorscale()
pyplot.show()

あまりきれいではありませんが、うまくいきます。FITSFigureを軸に直接取り付ける簡単な方法に遭遇した場合は、この回答を修正するか、新しい回答を追加します。

于 2016-06-13T07:55:33.607 に答える