Re: [R] saving multiple panes to PNG

2010-11-30 Thread Charles Evans

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  to see next plot:"

When one hits , 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@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.


Re: [R] saving multiple panes to PNG

2010-11-30 Thread Adaikalavan Ramasamy
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  to see next plot:"

When one hits, 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@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.


__
R-help@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.


Re: [R] saving multiple panes to PNG

2010-11-30 Thread Jannis
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  to see next plot:"

When one hits , 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@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.



__
R-help@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.


[R] saving multiple panes to PNG

2010-11-30 Thread Charles Evans
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  to see next plot:"

When one hits , 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@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.