我正在使用seaborn制作条形图,并希望在每个子图中添加一些文本。我知道如何向整个图形添加文本,但我想访问每个子图并添加文本。我正在使用以下代码:
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
这给了我这个:
![输入图片说明](https://istack.dev59.com/TsteI.webp)