2017-08-03 94 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轴