[R] saving multiple panes to PNG
Charles Evans
cevans at chyden.net
Tue Nov 30 15:22:22 CET 2010
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
More information about the R-help
mailing list