Dear Community,
Sorry to bother you again but I have a question relating to the legend for GGPLOT. I created a simple example to illustrate my question:
code in R
data <- data.frame(observation = c(1:5), actual = c(5,6,9,3,4), predicted = c(7,5,7,3,4))
plot <- ggplot(data = data, aes(x=data$observation, y=data$predicted)) +
geom_line(color = "green") +
geom_line(y = data$actual) +
ylim(0,10)
I would like to add in a legend saying:
green = predicted
black = actual
I saw a lot of examples with factors but is it also possible to add a legend for these lines?
Thank you in advance!
With kind regards,
DataMagic