Skip to content Skip to sidebar Skip to footer

Add Text Annotation To Seaborn Lmplot

I am trying to create seaborn lmplot for a clustering result, data example are shown below: ID CA IP clusters 38 10.3 5.6 1 59 10.4 6.1 0 64 10.

Solution 1:

The problem is that seaborn.regplot (used in the site you link to) return a matplotlib axes object which allows you to use the text function. However, seaborn.lmplot returns a FacetGrid.

Therefore you need to get the axes of the Facetgrid which you can do using

fgrid = sns.lmplot(...)
ax = fgrid.axes[0,0]  # fgrid.axes return an array of all axes in the figure, so we index the array

From here you can then use the function as shown in the link

Post a Comment for "Add Text Annotation To Seaborn Lmplot"