[英]Misaligned labels in Seaborn ridge plot
I noticed that if I change this line g.figure.subplots_adjust(hspace=-0.25)
in Seaborn ridge plot example here , the labels don't align well.我注意到,如果我在 Seaborn ridge plot example here中更改这条线
g.figure.subplots_adjust(hspace=-0.25)
,标签不会很好地对齐。 For example if I change the line to g.figure.subplots_adjust(hspace=-0.9)
, this is what I get in picture below.例如,如果我将行更改为
g.figure.subplots_adjust(hspace=-0.9)
,这就是我在下图中得到的。
Is there a way to match the labels when trying to overlap histograms more using g.figure.subplots_adjust(hspace=-0.9)
?尝试使用
g.figure.subplots_adjust(hspace=-0.9)
更多地重叠直方图时,有没有办法匹配标签?
For the y-axis labels, the strings are created individually and the y-axis position is determined manually.对于 y 轴标签,字符串是单独创建的,y 轴位置是手动确定的。 So changing the y-axis coordinates in ax.text() will produce the intended result.
所以改变 ax.text() 中的 y 轴坐标将产生预期的结果。 I tried it manually and 0.045 seemed optimal.
我手动尝试过,0.045 似乎是最佳的。 You can modify it to your liking.
您可以根据自己的喜好对其进行修改。
# Define and use a simple function to label the plot in axes coordinates
def label(x, color, label):
ax = plt.gca()
ax.text(0, .045, label, fontweight="bold", color=color,
ha="left", va="center", transform=ax.transAxes)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.