I am making bar graphs in seaborn and I want to add some text to each subplot. I know how to add text to the entire figure, but I want to access each subplot and add text. I am using this code:
import seaborn as sns
import pandas as pd
sns.set_style("whitegrid")
col_order=['Deltaic Plains','Hummock and Swale', 'Sand Dunes']
g = sns.FacetGrid(final, col="Landform", col_wrap=3,despine=False, sharex=False,col_order=col_order)
g = g.map(sns.barplot, 'Feature', 'Importance')
[plt.setp(ax.get_xticklabels(), rotation=45) for ax in g.axes.flat]
for ax, title in zip(g.axes.flat, col_order):
ax.set_title(title)
g.fig.text(0.85, 0.85,'Text Here', fontsize=9) #add text
During your for loop you already have each subplot available to you with ax
.
for ax, title in zip(g.axes.flat, col_order):
ax.set_title(title)
ax.text(0.85, 0.85,'Text Here', fontsize=9) #add text