I have the following code which creates a box plot of APOE4 gene copies and memory scores (hence the variable names)
clean_merged.boxplot('composite scores', by='APOE4', widths = 0.8, showmeans = True, meanline = True)
plt.title('Mean Composite Memory Score by APOE4 Copies')
plt.xlabel('Number of APOE4 Copies')
plt.ylabel('Composite Memory Score')
plt.rcParams['figure.figsize'] = (10,10)
which generates this output:
I would like to add a legend for the mean (green dashed) and median lines (solid fill) and am struggling to do so based on previously asked questions as how i have created my graph is quite different to the methods usually advised.
I'm new to python so any help is appreciated :) thanks !!!