I have problems with ggplot in R.
Here is my code:
ggplot(plot3)+
geom_line(mapping = aes(x= tider , y = andel_nätverk, color = "blue"))+
geom_line(mapping = aes(x= tider, y= andel_fängelse, color = "green"))+
geom_line(mapping = aes(x=tider, y= andel_reb, color = "red"))+
labs(x = "Tid", y= "Andel", color = "Platser")+
scale_color_manual(labels = c("R", "F", "N"), values = c("red", "green", "blue"))
The problem is that "andel_nätverk" and "andel_reb" changes place on the colors in the plot. So "andel_nätverk" is red and "andel_reb" is blue. If I put the color-argument outside aes the colors fit correctly but then I can't use scale_color_manuel and get legends. Does anyone know what the problem is ?