annotate seaborn pointplot with data values

Viewed 943

I would like to attach "values" assocated with each point in the pointplot generated by following code. My code follows below:

#data for pointplot with error bars
y = ['SC', 'GA', "FL", "MD"]
x = [.9, 1, 7, 4]
e = [.1, 0, .2, .3]

#plot
ax=sns.pointplot(x,y, join = False)
ax.errorbar(x,y, xerr=e, fmt='o', capsize=5)
ax.axvline(1, color='gray', linestyle='--')

#annotate points
for x,y in zip(x,y):
    ax.text(x, y,str(x),horizontalalignment='center',color='black',weight='light')
sns.despine()

The result is shown belowenter image description here

However, my text runs over the data points making the result look clumsy. How can I move the "values" in text to just above the data points?

0 Answers
Related