2016-07-27 44 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()