How can I add title on seaborn lmplot?

Viewed 32444

I am trying to add title on Searbon lmplot.

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

But I noticed that lmplot does not have an ax parameter. How can I add a title on my lmplot?

4 Answers

try this:

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

seaborn uses matplotlib under the hood, so if you want a simple answer, use:

plt.title('My Title')

Right before

plt.show()
sns.lmplot(x, y, data=df, hue="hue", ax=ax).fig.suptitle("Graph (a)")
Related