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)
As you can see, I have removed all grid lines. I would now like to add just one horizontal grid line: at the value of 5 on the y-axis for each plot. Is this possible to do? I looked into the set_style dictionary options here but found nothing helpful.
Thanks in advance!
The easiest way to get a grid line as an aide to the eye in the plot is to just draw a line onto every plot.
The upshot is that it's basically one line of code and the plot will have the feature you want. The downshot is that you have to manually specify where each line goes. (I assume that you want something a little more complicated in the production code). Something a little better would be
which would grab a single tick and draw a line for it.
You could probably do something with the individual
tick
objects to give a similar effect---they can be accessed witha.yaxis.get_major_ticks()
---but I wasn't able to use any of their methods to any effect.