向水平计数图添加水平

时间:2018-08-01 15:34:02

标签: python plot seaborn

我有几个如下的条形图,我想在每组条形上方添加水平线。我知道y坐标,但是如何自动获取xmin和ymin范围而无需手动查看它们?

sns.countplot(x="class", hue="who", kind="bar", data=titanic)
plt.hlines(y=30, xmin=-0.5, xmax=0.5, color='black', alpha=0.4)
plt.hlines(y=50, xmin=0.6, xmax=1.5, color='black', alpha=0.4)
plt.hlines(y=200, xmin=1.5, xmax=2.5, color='black', alpha=0.4)

enter image description here

0 个答案:

没有答案
相关问题