oehl_list@gmx.de
2002-Aug-06 16:16 UTC
polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
# polygon ignores requests to have its border transparent, look at par(bg="transparent") plot(c(0, 3), 0:1) polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0) polygon(c(1, 2, 2, 1), c(0, 0, 1, 1), border="transparent", col = 0) polygon(c(2, 3, 3, 2), c(0, 0, 1, 1), border=0, col = 0) # a quick fix for erase.screen() is the following erase.screen <- function (n = .split.cur.screen) { if (!exists(".split.screens", envir = .GlobalEnv)) return(FALSE) if (!(n %in% .split.valid.screens) && n != 0) stop("Invalid screen number\n") old <- par(usr = c(0, 1, 0, 1), mar = c(0, 0, 0, 0), fig = if (n > 0) .split.screens[[n]]$fig else c(0, 1, 0, 1), xaxs = "i", yaxs = "i") on.exit(par(old)) par(new = TRUE) plot.new() # bug in polygon, ignores border="transparent" # was: polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0) rect(0, 0, 1, 1, col=0, border=0) par(new = TRUE) invisible() } as borders are overlapping between subscreens, erasing one subscreen will set parts of borders of neighbor subscreens to background color. I guess this is better than not beeing able to erase the borders at all. However, if border shall not be erased have rect(0, 0, 1, 1, col=0, border="tranparent") instead. Alternatively we could introduce a new parameter border= to erase.screen(), screen() and split.screen() Best regards Jens Oehlschlägel> version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 5.1 year 2002 month 06 day 17 language R -- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2002-Aug-06 17:47 UTC
(PR#1881) polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
Strangely, it works without the first line, which is the default on a windows() device. There's a bug in GA_Polyline (not Polygon) stemming from the changes to graphics device internals at 1.4.0, it seems. It is transparent polylines one cannot draw, and only on the windows() device. You don't give an example for erase.screen: does this need a separate fix? On Tue, 6 Aug 2002 oehl_list@gmx.de wrote:> # polygon ignores requests to have its border transparent, look at > par(bg="transparent") > plot(c(0, 3), 0:1) > polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0) > polygon(c(1, 2, 2, 1), c(0, 0, 1, 1), border="transparent", col = 0) > polygon(c(2, 3, 3, 2), c(0, 0, 1, 1), border=0, col = 0) > > # a quick fix for erase.screen() is the following > erase.screen <- > function (n = .split.cur.screen) > { > if (!exists(".split.screens", envir = .GlobalEnv)) > return(FALSE) > if (!(n %in% .split.valid.screens) && n != 0) > stop("Invalid screen number\n") > old <- par(usr = c(0, 1, 0, 1), mar = c(0, 0, 0, 0), fig = if (n > > 0) > .split.screens[[n]]$fig > else c(0, 1, 0, 1), xaxs = "i", yaxs = "i") > on.exit(par(old)) > par(new = TRUE) > plot.new() > # bug in polygon, ignores border="transparent" > # was: polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0) > rect(0, 0, 1, 1, col=0, border=0) > par(new = TRUE) > invisible() > } > > as borders are overlapping between subscreens, erasing one subscreen will > set parts of borders of neighbor subscreens to background color. I guess this > is better than not beeing able to erase the borders at all. However, if border > shall not be erased have > rect(0, 0, 1, 1, col=0, border="tranparent") > instead. Alternatively we could introduce a new parameter border= to > erase.screen(), screen() and split.screen() > > Best regards > > > Jens Oehlschlägel > > > > > version > _ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 1 > minor 5.1 > year 2002 > month 06 > day 17 > language R > > > -- > > > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._