2016-06-14 3 views
0

일반 matplotlib 축 클래스에서 눈금 선을 특정 투명도 (알파 레벨)로 설정할 수 있습니다. 나는 다음을 사용하여 APLpy 패키지와 함께이를 활용하려고 해요 :APLpy/matplotlib : EPS 품질 그림에 대한 좌표계 알파 레벨

fig = pyplot.figure(figsize=(18,8)) 

gridspec_layout = gridspec.GridSpec(1,2) 

gridspec_layout1 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gridspec_layout[1], hspace=0.0, wspace=0.0) 

pyplot_0 = fig.add_subplot(gridspec_layout1[0]) 
pyplot_1 = fig.add_subplot(gridspec_layout1[1]) 
pyplot_2 = fig.add_subplot(gridspec_layout1[2]) 
pyplot_3 = fig.add_subplot(gridspec_layout1[3]) 
pyplot_4 = fig.add_subplot(gridspec_layout1[4]) 
pyplot_5 = fig.add_subplot(gridspec_layout1[5]) 
pyplot_6 = fig.add_subplot(gridspec_layout1[6]) 
pyplot_7 = fig.add_subplot(gridspec_layout1[7]) 
pyplot_8 = fig.add_subplot(gridspec_layout1[8]) 

M33 = aplpy.FITSFigure('myfits.fits', figure=fig, subplot=list(gridspec_layout[0].get_position(fig).bounds), dimensions=[0, 1], slices=[0]) 

M33 = aplpy.FITSFigure('myfits.fits') 
M33.show_grid() 
M33.set_grid_alpha(0.1) 

pyplot.savefig('myeps.eps', format='eps', dpi=800, clobber=True) 

그래서 투명도가 매우 높은 매우 미묘하다. 그러나 .eps 형식 파일로 플롯을 저장하면 투명도가 손실되고 선이 흰색입니다. 정상적인하기 matplotlib, 나는 일반적으로 사용 : 예상대로 투명도가 가지 모양

ax.set_rasterized(True) 

이러한 것을.

나는 aplpy.FITSFigure 클래스에 상응하는 것이 있는지 궁금합니다. ...?

감사합니다.

+0

'fig.axes'를 보면 'fig.axes'에 포함 된 'Axes'의 목록을 볼 수 있습니다. – tacaswell

답변

1

save 함수에는 선택적 인수 인 transparent가 있습니다. transparent는 기본적으로 False로 설정됩니다. True로 설정하면 저장할 때 투명도가 보존되어야합니다.

M33.save(filename, transparent=True, ..) 

ETA :

그래서 뭔가를해야한다 코멘트에서이 위의 코드는 당신이 저장하는 경우 작동하지 않습니다 있도록 EPS 형식, 투명도를 지원하지 않는 것을 지적했다 아래로 그 형식.

+0

기본 1x1 플롯보다 약간 더 복잡한 그림 그리기 루틴을 사용하고 있습니다. 나는 이것을 행운이 없도록 노력했다. 내 gridspec 레이아웃을 포함해야합니까? – user3125347

+0

물론, gridspec 레이아웃을 포함하십시오. dpi 설정 중입니까? – phormalitize

+0

예. 내가 아마도 관련이 있다고 생각하는 모든 것을 포함시킬 것이다 – user3125347