[R] looping multipanel plots to different figures
Jim Lemon
drjimlemon at gmail.com
Thu Feb 19 10:36:39 CET 2015
Hi efisio,
I read this as wanting to start a new graphics device, then set some plot
parameters, display two plots and then close the graphics device at each
iteration of the loop. If so,
plot_filenames<-c("plot1.png","plot2.png","plot3.png")
for(plotfn in plot_filenames) {
png(plotfn)
par(mfrow=c(1,2))
hist(sample(1:5,30,TRUE))
hist(sample(1:5,30,TRUE))
dev.off()
}
Jim
On Thu, Feb 19, 2015 at 7:25 PM, efisio solazzo <
efisio.solazzo at jrc.ec.europa.eu> wrote:
> Dear,
> cannot find a way to direct multipanel plots to different figures (files)
> while within a loop.
>
> Say, the loop creates two plots each step: one plot should go to figure 1
> and the other to figure 2.
> Same for the next steps of the loop: the plots should go to figure 1 and
> figure 2 in a multipanel fashion.
>
> I am not sure at which point to open the files and set the multipanel
> parameters...all I can get is two files with all plots overlaid to the same
> position.
>
> Thanks
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list