[英]Misaligned labels in Seaborn ridge plot
我注意到,如果我在 Seaborn ridge plot example here中更改這條線g.figure.subplots_adjust(hspace=-0.25)
,標簽不會很好地對齊。 例如,如果我將行更改為g.figure.subplots_adjust(hspace=-0.9)
,這就是我在下圖中得到的。
嘗試使用g.figure.subplots_adjust(hspace=-0.9)
更多地重疊直方圖時,有沒有辦法匹配標簽?
對於 y 軸標簽,字符串是單獨創建的,y 軸位置是手動確定的。 所以改變 ax.text() 中的 y 軸坐標將產生預期的結果。 我手動嘗試過,0.045 似乎是最佳的。 您可以根據自己的喜好對其進行修改。
# 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.