I have a dataframe named data with index, mean and median as variables. I have created the graph with this code.
ggplot(data, aes(x = index)) +
geom_line(aes(y = median), size = 1, colour="firebrick") +
geom_line(aes(y = mean), size = 1, colour = "dodgerblue4") + geom_point(size = 2, aes(y = median), colour = 'firebrick' ) +
geom_point(size = 2, aes(y = mean), colour = 'dodgerblue4' )
I want to add legend to this graph for median and mean. I am able to find legends only for factor of single variable. But not able to do it for two variables.
I am trying this,
scale_colour_manual("", breaks = c("Median", "Mean"),values = c("firebrick", "dodgerblue4"))
But no effect in the graph. Can anybody help me in doing this?
Thanks