Hello,
I have 6 dataframes called "January","February","March","April","May","June" (they show the reflectance of trees). I made a list of these dataframes and then a loop function to generate multiple plots.
long_list <- c("January","February","March","April","May","June")
myplot <- function(data, title){
ggplot(data, aes(x = bands, y = reflectance, color = class, group = class)) +
geom_point(color="grey") +
geom_line () +
labs(title = title)
}
for(i in long_list){
print(myplot(get(i), i))
}
It worked; I am happy with the result.
But(!) I am not able to display all this plots in one window. I tried it with
par(mfrow=c(3,2))
and
myplot(long_list, col=3)
and
cowplot::plot_grid()
and
grid.arrange(myplot(long_list), nrow = 2, ncol = 3)
but was`t successful
How can I display these 6 generated plots in one window (col 3 and row 2)
Thanks!