I have a question about legends in ggplot2. I managed to plot two lines and two points in the same graph and want to add a legend with the two colors used. This is the code used
P <- ggplot() + geom_point(data = data_p,aes(x = V1,y = V2),shape = 0,col = "#56B4E9") + geom_line(data = data_p,aes(x = V1,y = V2),col = "#56B4E9")+geom_point(data = data_p,aes(x = V1,y = V3),shape = 1,col = "#009E73") + geom_line(data = data_p,aes(x = V1,y = V3),col = "#009E73")
and the output is enter image description here
I try to use scale_color_manual and scale_shape_manual and scale_line_manual,but they don't work .
P + scale_color_manual(name = "group",values = c('#56B4E9' = '#56B4E9','#009E73' = '#009E73'),
breaks = c('#56B4E9','#009E73'),labels = c('B','H')) +
Here is the simple data if it can help you.
5 0.49216 0.45148
10 0.3913 0.35751
15 0.32835 0.30361