I am trying to plot mean line using displot. I am trying to replicate this example but getting error.
from matplotlib import pyplot
g = sns.displot(data=df, x='age', kind="kde", hue="attrition", palette="crest", fill=True,alpha=.7, linewidth=0,)
g.fig.set_figwidth(15)
g.fig.set_figheight(5)
kdeline = g.lines[0]
mean = x.mean()
height = np.interp(mean, kdeline.get_xdata(), kdeline.get_ydata())
g.vlines(mean, 0, height, color='crimson', ls=':')
g.set_ylim(ymin=0)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-26-86084b5eb03a> in <module>
5 g.fig.set_figwidth(15)
6 g.fig.set_figheight(5)
----> 7 kdeline = g.lines[0]
8 mean = x.mean()
9 height = np.interp(mean, kdeline.get_xdata(), kdeline.get_ydata())
AttributeError: 'FacetGrid' object has no attribute 'lines'