[R] saving multiple panes to PNG

Jannis bt_jannis at yahoo.de
Tue Nov 30 15:43:42 CET 2010


Do you want the stuff to appear on one page? Have you tried opening a 
device with multiple plots? For example via:

par(mfrow=c(2,2))

or:

layout(matrix(1:4,2,2))



Other than that the documentation for the "vars" package gives you 
details for a plot function that may be used for plotting your irf 
objects. There is an argument (plot.type) that can be set to plot 
multiple plots on one page.
??

HTH
Jannis


Charles Evans schrieb:
> After searching multiple combinations of keywords over the past two 
> days and downloading n R graphics tutorials, I have not been able to 
> find anything online or in my R books about how to save multiple plot 
> panes to PNG.
>
> Specifically, I am using the irf() function in the vars package to 
> generate plots of Impulse Response Functions:
>
> > x.data <- cbind(na.omit(returns(p[,2])),na.omit(returns(n[,2])))
> > colnames(x.data) <- c("p.ret","n.ret")
> > x.jo <- ca.jo(x.data,type="trace",ecdet="none",spec="transitory")
> > x.var <- vec2var(x.jo)
> > x.irf <- irf(x.var,n.ahead=30)
> > plot(x.irf)
>
> This results in a plot containing a pair of IRF graphs in Quartz and 
> the following message in the Console:
>
> "Hit <Return> to see next plot:"
>
> When one hits <Return>, the next pair of IRF graphs appears in Quartz.
>
> When I try to save the plots to PNG
>
> > png(...)
> > plot(...)
> > dev.off()
>
> I am able to save only one of the plots.  How does one tell plot() to 
> plot first one of the panes and then the second?
>
> Any help would be greatly appreciated.
>
> Yours,
>
> Charles Evans
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



More information about the R-help mailing list