Sample, which provides details of whether the data was collected in the lab labelled L or in the review labelled R
Year, which contains the year in which the leaf is sampled
SD, which includes the stomatal density measured on the leaf
I am trying to add one line of SD over time of L samples and a second line of SD over time of R samples. Here is the code that I am trying to use but it is not working:
There is a more elegant solution mapping the color aesthetic to the Sample variable, I'm going to give you an example using a built-in data frame (since you haven't provided sample data).
library(ggplot2)
ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_smooth() +
scale_color_manual(values = c("setoda" = "gray", "versicolor" = "black", "virginica" = "blue"))
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'
Created on 2021-03-07 by the reprex package (v1.0.0.9002)