如何在不改变这些条形宽度的情况下近似图表的条形图? (Matplotlib)

How can I approximate the bars of a chart without changing the width of those bars? (Matplotlib)

所以,基本上我想要的是减少两个条之间的距离,但我在互联网上看到的所有解决方案都是人们改变条的宽度,这不是我想要的。

这是我的图表:

x = ['Goal (95%)','Achieved (100%)']
y = [95,100]

plt.bar(x,y,color = ('darkcyan','green'), width = 0.2)
plt.ylabel('Percentage (%)')

我期待这样的事情:

如果我改变宽度,我可以减少距离,但钢筋变得很粗,我希望它们变细。

plt.bar(x,y,color = ('darkcyan','green'), width = 0.8)
plt.ylabel('Percentage (%)')

通过更改图形大小然后更新宽度,我得到了非常接近您想要工作的东西。

plt.figure(figsize=(3,4))
plt.bar(x,y,color = ('darkcyan','green'), width = 0.8)

通常当您缩小图形尺寸时,条形会变得更窄,因此将它与较粗的条形结合起来似乎可以解决问题。您可以稍微调整一下数字,以获得您想要的结果。