![](/img/trans.png)
[英]How can I enumerate and add margin_titles to each subplot in a seaborn lmplot facetgrid?
[英]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.