2
This is my code:
library(ggplot2)
library(gridExtra)
df <- data.frame(x = 1:100,
y1 = runif(100),
y2 = runif(100)^2)
plot_list <- list(
plot1 = ggplot(df, aes(x, y1)) + geom_point(),
plot2 = ggplot(df, aes(x, y2)) + geom_point()
)
What I need is to access each Plot in this list using a for loop along with x11()
:
for (i in 1:length(plot_list)) {
x11()
plot_list[i]
}
Why doesn’t it work?
Some help?
Thank you!
Laura
Change
plot_list[i]
forprint(plot_list[[i]])
orshow(plot_list[[i]])
. Ahhh and you’re in the stack in Portuguese, I think q got confused in the language of the post kkk– Jorge Mendes
@Jorgemendes didn’t even notice!! kkkk I’ll do the translation kkk
– Laura
@Jorgemendes thank you very much!!
– Laura