Im new to R, and I am not able to add a legend to my chart in R, ggplot.
The code is:
ggplot(utregnet_data_R, aes(x= Sted)) +
geom_line(aes(y = Alder.ar,group=1), color = "black") +
geom_line(aes(y = Fremmede.arter.prosent,group=2), color = "red") +
geom_line(aes(y = onskede.arter.prosent,group=3), color = "blue") +
labs(x="Sted", y="Prosent")
I have tried the method answered in: https://community.rstudio.com/t/adding-manual-legend-to-ggplot2/41651
But it will not work.
Does anyone have a solution?
I tried this method https://community.rstudio.com/t/adding-manual-legend-to-ggplot2/41651 but It did not work.