Thank you everyone who contacted me so quickly!
I am posting the solution here, so that it is in the archive:
> plot(x.irf , plot.type="multiple" , names="p.ret")
> plot(x.irf , plot.type="multiple" , names="n.ret")
The returns() function in is the timeSeries package. However, one can
replace the "na.omit(returns(x[,2]))" bits below with any two vectors
of data.
C.Evans
On 30 Nov 2010, at 9:22 AM, 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
______________________________________________
[email protected] 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.