[Rd] split.screen bug and patch

Dan Kelley kelley.dan at gmail.com
Sat Apr 4 16:39:25 CEST 2009

I hope it's OK to post a bug report, and a possible patch, on this list.


The split.screen() docs suggest that users should not return to a screen
after it has been drawn, and that curious errors may result from doing so. 
This is clear from the test file I put below.  However, I have found that
this test file will work properly, with a tiny change to the split.screen
code.  I am posting this here in case it might help others.  (Certainly, I
make no claim that this solves a general problem with split.screen, but baby
steps are steps, nonetheless.)

The test file draws red lines in the wrong place, unless f=0.5.  But it
works OK after the split.screen code is edited as given in the last section
of this email.

Test file

f <- 0.7                                # works only if f=0.5
split.screen(matrix(c(0,f,0,1, f,1,0,1), nrow=2, byrow=TRUE))
plot(1:10, 1:10)
plot(1:3, 1:3)

Code change

Near the start of src/library/graphics/R/screen.R edit the assign() to look
as follows.  The addition solves the problem of the test file, and the
deletion solves a problem in building packages that use split.screen().

         "adj", "bty", "cex", "col", "crt", "err", "font", "lab",
         "las", "lty", "lwd", "mar", "mex",
         "fin", ## added                                                        
         ## "mfg", ## deleted                                                   
         "mgp", "pch",
         "pty", "smo", "srt", "tck", "usr",
         "xaxp", "xaxs", "xaxt", "xpd",
         "yaxp", "yaxs", "yaxt", "fig"), envir=.oceSSenv)

View this message in context: http://www.nabble.com/split.screen-bug-and-patch-tp22884064p22884064.html
Sent from the R devel mailing list archive at Nabble.com.

More information about the R-devel mailing list