用Pandas数据框注释Seaborn stripplot中的点

amc*_*amc 1 annotate matplotlib pandas seaborn

是否有可能在seaborn的stripplot上注释每个点?我的数据在pandas数据框中.我意识到注释适用于matplotlib,但我没有发现它在这种情况下工作.

aor*_*orr 5

你只需要返回axes对象.以下示例改编自此处seaborn文档:

import seaborn as sns

sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
sat_mean = tips.loc[tips['day'] == 'Sat']['total_bill'].mean()

ax = sns.stripplot(x="day", y="total_bill", data=tips)
ax.annotate("Saturday\nMean",
            xy=(2, sat_mean), xycoords='data',
            xytext=(.5, .5), textcoords='axes fraction',
            horizontalalignment="center",
            arrowprops=dict(arrowstyle="->",
                            connectionstyle="arc3"),
            bbox=dict(boxstyle="round", fc="w"),
            )
#ax.get_figure().savefig('tips_annotation.png')
Run Code Online (Sandbox Code Playgroud)

png输出