From oehl_list@gmx.de  Tue Aug  6 17:16:22 2002
From: oehl_list@gmx.de (oehl_list@gmx.de)
Date: Tue, 6 Aug 2002 18:16:22 +0200 (MET DST)
Subject: polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
Message-ID: <200208061616.SAA26682@pubhealth.ku.dk>

# 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 Oehlschlgel



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


polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
oehl_list@gmx.de