2012-10-30 61 views
15

我有一個圖我添加了子圖到(插圖)。我已經使用:如何更改matplotlib中軸對象的刻度的字體大小

fig = plt.figure() 
ax = fig.add_subplot(111) 
subA = fig.add_axes([0.4,0.14,0.2,0.2]) 

我現在想換子圖的xtick字體大小。我嘗試了一些天真的做法,如

subA.get_xaxis().get_xticks().set_fontsize(10) 

沒有任何運氣。

那我該怎麼做呢?

回答

20
fig = plt.figure() 
ax = fig.add_subplot(111) 
plt.xticks([0.4,0.14,0.2,0.2], fontsize = 50) # work on current fig 
plt.show() 

的X/yticks具有相同的屬性matplotlib.text

+0

這是行不通的! –

30

用途:

subA.tick_params(labelsize=6) 
+6

如果您不想重新指定刻度標籤,這是一個更好的解決方案 –

相關問題