有没有办法将所有内容保存plots
为单个pdf
文档
library(tidyverse)
library(lubridate)
set.seed(123)
DF1 <- data.frame(Date = seq(as.Date("2001-01-01"), to= as.Date("2003-12-31"), by="day"),
A = runif(1095, 0,10),
D = runif(1095,5,15))
DF1 %>% pivot_longer(names_to = "Variable", values_to = "Value", -Date) %>%
ggplot(aes(x = Date, y = Value))+
geom_line()+
facet_wrap(~Variable)+
ggsave("Plot1.pdf", dpi = 200, height = 6, width = 8)
DF2 <- data.frame(Date = seq(as.Date("2005-03-01"), to= as.Date("2005-05-31"), by="day"),
Z = runif(92, 0,10))
DF2 %>% ggplot(aes(x = Date, y = Z))+
geom_line()+
ggsave("Plot2.pdf", dpi = 200, height = 6, width = 8)