[ESS] par(ask=T) in ESS
Stephen Eglen
S.J.Eglen at damtp.cam.ac.uk
Tue Oct 3 12:52:11 CEST 2006
Dear Christophe,
Thanks for providing the example code! (Although it just needs
something like "t <- 1:100" to work)
> Here is an example code:
>
> sig1 <- ts(sin(2*pi*t/100),frequency=10)
> sig2 <- ts(sin(2*pi*t/50),frequency=10)
>
> s1 <- spectrum(sig1,plot=FALSE)
> s2 <- spectrum(sig2,plot=FALSE)
>
> z1 <- fft(sig1)
> z2 <- fft(sig2)
>
> par(mfrow=c(2,2),ask=F)
> plot(sig1,type='l',col='red')
> plot(s1$freq,s1$spec,log='x')
> plot(sig2,type='l',col='blue')
> plot(s2$freq,s2$spec,log='x')
>
> par(mfrow=c(2,2),ask=T)
> plot(sig1,type='l',col='red')
> plot(abs(z1))
> plot(sig2,type='l',col='blue')
> plot(abs(z2))
>
>
> Is there any way to make par(ask=T) work under ESS? Or is it a bad
> idea to expect interaction between the *R* process while it is
> evaluating a region?
Yes, right now this is a problem. I can't think of an immediate way
around this - Ctrl G may help you out here.
> Actually, I need to use 'par(ask=T)' because I am trying to avoid
> opening new windows for each graphics because this is not portable
> (x11() for linux does not work when I send my code to my colleagues
> using Windows').
I wonder if you could write a function, something like new.window()
that would check getOption("device") to then launch the appropriate
new window?
Stephen
More information about the ESS-help
mailing list