steve_koehler@securecomputing.com
2003-Dec-30 16:35 UTC
[Rd] split.screen problem with jpeg/png device (PR#6223)
Full_Name: Steve Koehler Version: 1.8.1 OS: Solaris and Windows Submission from: (NULL) (192.55.214.50) In the following program, if output is sent to X11, you get all four graphs, but if output is sent to .jpeg, you only get the C and D graphs. A workaround is to do all the screen splitting at the top, before using any screens. This also fails with .png output. jpeg ("test.jpeg") #x11() a <- split.screen (c(2, 1)) screen (a[1]) b <- split.screen (c(1, 2)) screen (b[1]) plot (1:10, main="a") screen (b[2]) plot (1:10, main="b") screen (a[2]) d <- split.screen (c(1, 2)) screen (d[1]) plot (1:10, main="c") screen (d[2]) plot (1:10, main="d") close.screen (all=TRUE) dev.off()
Simon Urbanek
2003-Dec-30 19:05 UTC
[Rd] split.screen problem with jpeg/png device (PR#6223)
On Dec 30, 2003, at 4:37 PM, steve_koehler@securecomputing.com wrote:> Full_Name: Steve Koehler > Version: 1.8.1 > OS: Solaris and Windows > Submission from: (NULL) (192.55.214.50) > > > In the following program, if output is sent to X11, you get all four > graphs, > but if output is sent to .jpeg, you only get the C and D graphs. A > workaround > is to do all the screen splitting at the top, before using any > screens. This > also > fails with .png output. > > jpeg ("test.jpeg") > #x11() > > a <- split.screen (c(2, 1)) > > screen (a[1]) > b <- split.screen (c(1, 2)) > screen (b[1]) > plot (1:10, main="a") > screen (b[2]) > plot (1:10, main="b") > > screen (a[2]) > d <- split.screen (c(1, 2))This implicitly uses erase=TRUE and will erase previous screens on the device (including the top one - which is probably the bug) - if you use erase=FLASE then you get all four plots. (confirmed with R-devel and png device on Darwin)> screen (d[1]) > plot (1:10, main="c") > screen (d[2]) > plot (1:10, main="d") > > close.screen (all=TRUE) > > dev.off() > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > stat.math.ethz.ch/mailman/listinfo/r-devel >
Prof Brian Ripley
2003-Dec-30 19:51 UTC
[Rd] split.screen problem with jpeg/png device (PR#6223)
The background colour is transparent with X11 and white with jpeg. What you are doing is to replot over the whole screen, and it will erase the whole screen. You just don't see that under X11 with the default bg colour. If there is a problem at all, it is with X11: jpeg is working as documented. (Hint: split.screen defaults to erase=TRUE.) On Tue, 30 Dec 2003 steve_koehler@securecomputing.com wrote:> Full_Name: Steve Koehler > Version: 1.8.1 > OS: Solaris and Windows > Submission from: (NULL) (192.55.214.50) > > > In the following program, if output is sent to X11, you get all four graphs, > but if output is sent to .jpeg, you only get the C and D graphs. A workaround > is to do all the screen splitting at the top, before using any screens. This > also > fails with .png output. > > jpeg ("test.jpeg") > #x11() > > a <- split.screen (c(2, 1)) > > screen (a[1]) > b <- split.screen (c(1, 2)) > screen (b[1]) > plot (1:10, main="a") > screen (b[2]) > plot (1:10, main="b") > > screen (a[2]) > d <- split.screen (c(1, 2)) > screen (d[1]) > plot (1:10, main="c") > screen (d[2]) > plot (1:10, main="d") > > close.screen (all=TRUE) > > dev.off()-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, stats.ox.ac.uk/~ripley University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595