Given the following:
import seaborn as sns
attend = sns.load_dataset("attention")
sns.set_style("whitegrid", {'axes.grid' : False,'axes.edgecolor':'none'})
g = sns.FacetGrid(attend, col="subject", col_wrap=5,
size=1.5, ylim=(0, 10))
ax = g.map(sns.pointplot, "solutions", "score", scale=.7)
I would like to label individual data points (put value labels in place of dots) on each line. In another plot that I created via MatPlotLib only, this was accomplished like this:
for i, text in enumerate(ind):
a.annotate(str(y[i])[:-2], xy=(ind[i], y[i]),fontsize=6, color=c,
bbox=dict(pad=.9,alpha=1, fc='white',color='none'),va='center', ha='center',weight='bold')
However, since there is no ind defined, I'm not sure how this would work.
I wouldn't know what
ind
is either. But if the aim is to annotate the points with their coordinates, you may useax.annotate
inside a function that is mapped to theFacetGrid
as follows:Possibly, you need to use
xy=(i, y.values[i])
in the annotation, depending on what the data looks like.Note that this also answers your previous question by putting the
axhline
in that function as well.If the aim is to replace the points by the annotations, use
xytext = (0,0)
or leave that argument out completely; then also keepbbox=dict(pad=.9,alpha=1, fc='w',color='none')
and usemarkers=""
in the function call: