2016-11-25 29 views
3

說我有這個數據幀:熊貓:設置不同ylim和標題不同的次要情節

Type  Cat1  Cat2  Cat3 
0 A  0.384000 0.393000 0.458000 
1 B  0.603337 0.381470 0.299773 
2 C  0.585797 0.452570 0.317607 
3 D  0.324715 0.765212 0.717755 

那我畫出這樣的(from here):

axes = df.set_index('Type').plot.bar(subplots=True, legend=False) 
plt.subplots_adjust(hspace=0.35) 

enter image description here

我的問題:我如何爲每個子區域設置不同的ylim?我該如何修改Cat標題的字體大小?

回答

4

繪圖方法在您的axes變量中返回軸的數組。您可以訪問每一個並設置標題和ylim。

axes = df.set_index('Type').plot.bar(subplots=True, legend=False) 
plt.subplots_adjust(hspace=0.35) 
axes[0].set_ylim(0, 1.1) 
axes[0].set_title('hello') 

enter image description here