2012-08-13 93 views
0

我正在使用healpy的mollview()函數(http://healpy.github.com/healpy/generated/healpy.visufunc.mollview.html)來繪製地圖。我可以指定顏色條的標題和標籤,但我看不到我可以如何更改字體大小。對不起,如果這不是發佈這個問題的正確地方......我找不到任何地方在healpy的項目頁面上提問。我也不能把這個問題標記爲「healpy」,因爲我沒有足夠的聲譽,以前從來沒有人問過關於healpy的問題。更改healpy.mollview中的colorbar標籤的字體大小()

回答

1

對不起,遲到的回答,但如果有人認爲這從谷歌有用:

您可以更改字體大小在劇情中的所有文本更新rcParams

import matplotlib 
matplotlib.rcParams.update({'font.size': 22}) 
1

另一個反應遲緩:

不幸的是,rcParams不適用於units問題,因爲這是hp.visufunc.mollview函數中的text對象。

import healpy as hp 
import numpy as np 
import matplotlib 

fontsize = 20 

d = np.arange(12*16**2) 
hp.mollview(d, title='Hello', unit=r'T', notext=False, coord=['G','C']) 

matplotlib.rcParams.update({'font.size':fontsize}) 
matplotlib.pyplot.show() 

incomplete

正如你所看到的,對應單元的座標系中的文本對象,並不會受到影響,因爲他們只是有一個單獨的文字處理系統。這可以通過使用gcf()功能改變的對象,即

import healpy as hp 
import numpy as np 
import matplotlib 

fontsize = 20 

d = np.arange(12*16**2) 
hp.mollview(d, title='Hello', unit=r'T', notext=False, coord=['G','C']) 

matplotlib.rcParams.update({'font.size':fontsize}) 
matplotlib.pyplot.show() 

f = matplotlib.pyplot.gcf().get_children() 
HpxAx = f[1] 
CbAx = f[2] 

coord_text_obj = HpxAx.get_children()[0] 
coord_text_obj.set_fontsize(fontsize) 

unit_text_obj = CbAx.get_children()[1] 
unit_text_obj.set_fontsize(fontsize) 

matplotlib.pyplot.show() 

complete