分组group
library(dplR)
data(package = "dplR")
data(nm046)
nm046 %>%
mutate(year =as.double(rownames(.)), .before = 1) %>%
pivot_longer(cols = !year, names_to = "tree", values_to = "value") %>%
ggplot(aes(x = year, y = value, group = tree, color = tree))+
geom_line()+
theme_bw()

分面
nm046 %>%
mutate(year =as.double(rownames(.)) , .before = 1) %>%
pivot_longer(cols = !year, names_to = "tree", values_to = "value") %>%
ggplot(aes(x = year, y = value, group = tree, color = tree))+
geom_line()+
facet_wrap(~tree, ncol = 2)+
theme_bw()
