Stephen Tucker <brown_emu <at> yahoo.com> writes:

> Hi, 
> 
> Does anyone know if there is a way to 'reset the plot number' on a 
traditional graphics device?
> 
> For instance, I want to have two plots on stacked top of each other (mfrow=c
(2,1)) but with underlying grid
> lines spanning both figures vertically.


Below is one approach using split.screen. See ?split.screen for details.

> split.screen(c(1,1))
[1] 1
> screen(1)
> plot.window(c(0,1),c(0,1))
> abline(v=seq(0,1,by=0.2),lty=3)
> split.screen(c(2,1))
[1] 2 3
> screen(2)
> plot.new()
> plot.window(c(0,1),c(0,1))
> for(i in 1:2) axis(i)
> box(bty="L")
> rect(0.2,0.2,0.5,0.5,col=8)
> screen(3)
> plot.new()
> plot.window(c(0,1),c(0,1))
> for( i in 1:2) axis(i)
> box(bty="L")
> close.screen()
[1] 1 2 3

Mark Lyman

______________________________________________
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.

Reply via email to