簡體   English   中英

如何在seaborn lmplot上添加標題?

[英]How can I add title on seaborn lmplot?

我想在Searbon lmplot上添加標題。

ax = plt.axes()
sns.lmplot(x, y, data=df, hue="hue", ax=ax)
ax.set_title("Graph (a)")
plt.show()

但是我注意到lmplot沒有ax參數。 如何在我的lmplot上添加標題?

試試這個:

sns.lmplot(x, y, data=df, hue="hue")
ax = plt.gca()
ax.set_title("Graph (a)")
# Create lmplot
lm = sns.lmplot(x, y, data=df, hue="hue", ax=ax)

# Access the figure
fig = lm.fig 

# Add a title to the Figure
fig.suptitle("My figtitle", fontsize=12)
sns.lmplot(x, y, data=df, hue="hue", ax=ax).fig.suptitle("Graph (a)")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM