I have data frames as follows:
tt <- as.POSIXct("20180810 00:00:01", format = "%Y%m%d %H:%M:%S")
tts <- seq(tt, by = "hours", length = 6)
df.1 <- data.frame(tts, t=c(10,20,30, NA, 15, 12), hr=c(0,1,2, NA, 4, 5))
df.2 <- data.frame(tts, t=c(14,NA,9, 2, NA, NA), hr=c(0,1,NA, 3, 4, 5))
Plotting both df´s individually works fine and as expected!:
ggplot(subset(df.1, !is.na(t))) +
geom_point(mapping = aes(tts, hr, fill = t) ,shape = 22, size = 5) +
scale_fill_gradient(low="green", high="red")
ggplot(subset(df.2, !is.na(t))) +
geom_point(mapping = aes(tts, hr, fill = t) ,shape = 22, size = 5) +
scale_fill_gradient(low="green", high="red")
But I´d like to do sth like I tried below and "store plots", so that I could plot these, and other plots later...sth like: :
for (count in seq(from = 1,to = 2, by =1)){
pk<-paste0("df."count)
assign("pl."count) <- ggplot(subset(pk, !is.na(t))) +
geom_point(mapping = aes(tts, hr, fill = t) ,shape = 22, size = 5) +
scale_fill_gradient(low="green", high="red")
...
}
Any ideas?
Thanks in advance!