2016-07-27 80 views
-1

所以我嘗試使用APLpy密謀配合圖像(相同適合圖像)與由DS9區域文件提供了一些註解:與gridspec與APLpy打印問題

我的腳本如下:

import aplpy 

import matplotlib 
import matplotlib.pyplot as pyplot 
import matplotlib.gridspec as gridspec 

from astropy.io import fits 

matplotlib.rc('xtick', labelsize=8) 
matplotlib.rc('ytick', labelsize=8) 
#matplotlib.rc('text', usetex=True) 
#matplotlib.rcParams['xtick.direction'] = 'out' 
#matplotlib.rcParams['ytick.direction'] = 'out' 
matplotlib.rcParams['grid.alpha'] = 0.3 

nullfmt = pyplot.NullFormatter() 

fig = pyplot.figure(figsize=(26,12)) 

gridspec_layout = gridspec.GridSpec(1,2) 
#gridspec_layout.update(hspace=0.0, wspace=0.005) 

M33_galax = aplpy.FITSFigure('/Users/.../SDSS_g_c_rescale.fits', figure=fig, subplot=list(gridspec_layout[0].get_position(fig).bounds), dimensions=[0, 1], slices=[0]) 
M33_stars = aplpy.FITSFigure('/Users/.../SDSS_g_c_rescale.fits', figure=fig, subplot=list(gridspec_layout[1].get_position(fig).bounds), dimensions=[0, 1], slices=[0]) 
#dimensions=[0, 1], slices=[1] 

M33_galax.show_regions('SDSS_galaxy_match.reg') 
#M33_stars.show_regions('') 

M33_galax.set_tick_labels_format(xformat='hh:mm:ss.ss',yformat='dd:mm:ss') 
M33_galax.set_tick_labels_font(size='x-small') 
M33_galax.axis_labels.set_ytext(r'$\delta\,,\mathrm{Dec}\,\mathrm{(J2000)}$') 
M33_galax.axis_labels.set_xtext(r'$\alpha\,,\mathrm{RA}\,\mathrm{(J2000)}$') 
M33_galax.axis_labels.set_font(size='small') 
M33_galax.axis_labels.set_ypad(10) 
M33_galax.axis_labels.set_xpad(10) 
M33_galax.add_grid() 
M33_galax.grid.set_alpha(0.1) 

M33_stars.set_tick_labels_format(xformat='hh:mm:ss.ss',yformat='dd:mm:ss') 
M33_stars.set_tick_labels_font(size='x-small') 
M33_stars.axis_labels.set_ytext(r'$\delta\,,\mathrm{Dec}\,\mathrm{(J2000)}$') 
M33_stars.axis_labels.set_xtext(r'$\alpha\,,\mathrm{RA}\,\mathrm{(J2000)}$') 
M33_stars.axis_labels.set_font(size='small') 
M33_stars.axis_labels.set_ypad(10) 
M33_stars.axis_labels.set_xpad(10) 
M33_stars.add_grid() 
M33_stars.grid.set_alpha(0.1) 

pyplot.show() 

然而,我發現下面是輸出:

enter image description here

會有人知道我在哪裏有個腳麻是什麼?

+0

什麼是你期待發生的圖像,例如:? – DavidG

+0

@DavidG Errrr,在兩個繪圖區域內,我應該看到我正在加載的兩個適合文件。具體來說,SDSS g濾波器圖像的星系...(兩者都一樣)加載兩次。 – user3125347

回答

2

您需要使用show_grayscaleshow_colorscale顯示

M33_galax.show_grayscale()