Pandas Plot,如何控制条宽和间隙
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34233347/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 00:22:17 来源:igfitidea点击:
Pandas Plot, how to control the bar width and the gaps
提问by xpt
Hope this is an easy question -- how to control the bar width and the gaps when plotting with Pandas?
希望这是一个简单的问题——在使用 Pandas 绘图时如何控制条宽和间隙?
Full code is here, reposted below:
完整代码在这里,转发如下:
df = pd.DataFrame({
'person':[x*3 for x in list('ABCDEF')],
'score1':np.random.randn(6),
'score2':np.random.randn(6),
'score3':np.random.randn(6),
'score4':np.random.randn(6),
'score5':np.random.randn(6)
})
print(df)
ax = df.set_index(['person']).plot(kind='barh')
ax.invert_yaxis()
The result bar width is too thin and the gaps is too wide, how can I fix it? Thanks.
结果条宽度太细,间隙太宽,我该如何解决?谢谢。