[R] saving multiple panes to PNG

Adaikalavan Ramasamy a.ramasamy at imperial.ac.uk
Tue Nov 30 15:53:32 CET 2010


I cannot run your example because I cannot identify which package the 
function returns is from.

Nonetheless, something like par(mfrow=c(2,3)) should do the trick.

Regards, Adai



On 30/11/2010 14:22, Charles Evans wrote:
> 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