2017-08-03 120 views
1

我有數據幀,看起來像這樣大熊貓情節修改y軸

enter image description here

我想繪製它:

df2[['width', 'height', 'depth']].head(20).plot.bar(figsize=(8, 8), fontsize=16) 

enter image description here

偉大的作品,但我需要增加Y軸的點數。我想添加2400,1900等數字,我該怎麼做?爲什麼Y軸只有6個點?

+0

可以粘貼一些數據,讓我們可以嘗試做同樣的出幾件事? –

+0

@ClockSlave https://pastebin.com/3XyxxURV – twoface88

回答

1

好的,你只需要通過yticks的參數。 yticks不是bar的直接參數,但它傳遞給plot

df2[['width', 'height', 'depth']].head(20).plot.bar(figsize=(8, 8), fontsize=16, yticks = range(0,2600,200)) 
plt.show() 

結果:

enter image description here

您也可以使用xticks,如果你想爲x軸