简短回答:
plt.bar(0, 1, align="center")
为什么?
这个
documentation on github
表示要使用
align=edge
:
默认值为现在
(x - width/2, x + width/2, bottom, bottom + height)
[...] 这个
排列
仅关键字参数控件,如果
x个
已解释
作为矩形的中心或左边缘。[...]
align : {'center', 'edge'}, optional, default: 'center'
If 'center', interpret the *x* argument as the coordinates
of the centers of the bars. If 'edge', aligns bars by
their left edges
To align the bars on the right edge pass a negative
*width* and ``align='edge'``