【问题标题】:Reduce spacing between bars in seaborn hist plot减少 seaborn hist 图中条形之间的间距
【发布时间】:2022-07-22 19:55:12
【问题描述】:

我正在绘制一些数据

g = seaborn.displot(data, x=var, stat='probability')

# Set appropriate ticks                   
plt.xticks(np.arange(0, int(data[var].max() + 1), 1.0))
plt.show()

这给了我想要的情节:

但我想压缩轴以删除不必要的空间,我正在努力弄清楚如何。

【问题讨论】:

  • 检查herehere - 也许你会找到答案。

标签: python matplotlib seaborn


【解决方案1】:

您可以增加在数据限制两侧添加的margins以获得查看限制。默认为0.05

plt.margins(0.5, 0.5)

【讨论】: