Hi, I'm new to R so I'm not sure if I'm doing this correctly.
I have already added a geom_hline for each facet_grid using the following code:
y = ggplot(dat, aes(x, y)) +
theme_classic() +
geom_boxplot(aes(fill=group)) + facet_rep_grid(.~group, scales = 'free', ) +
scale_fill_manual(values=color_scheme)
p1 = y +
geom_hline(aes(yintercept=healthy.baseline.mean, linetype="Line 1"),
linetype='dotted', color='red', show.legend = TRUE)
But the legend for the geom_hline looks something like this:
Looks like the geom_hline for each panel in the facet_grid was supperimposed to the boxplot legend.
How can I make a separate legend for the geom_hline such that I have five boxplot legend and 1 red-dotted legend for the geom_hline?
P.S. The geom_hline is the same for all panel because it represents the mean across data group.
Thanks!