[英]Can't get bar chart to plot in matplotlib
By default, each bar is plotted with a width of 0.8
and due to the large range of x values on your plot, that is too narrow to be visible when rendered. 默认情况下,每个条形图的宽度均为0.8
并且由于绘图中的x值范围较大,因此在渲染时太窄而无法显示。 You'll instead want to specify a larger width using the width
kwarg 相反,您需要使用width
kwarg指定更大的width
plt.bar(x, y, width=20)
You an also use an array for the width
value to specify a different width for each bar 您还可以使用数组作为width
值,为每个条指定不同的宽度
plt.bar(x, y, width=[3000, 20, 20])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.