R/rect.R

Defines functions C_rect

# C_rect(xleft, ybottom, xright, ytop, col, border, lty, lwd, ...)

C_rect <- function(x) {
    dev.set(recordDev())
    par <- currentPar(x[-(1:9)])
    dev.set(playDev())
    depth <- gotovp(par$xpd)
    xleft <- tx(x[[2]], par)
    ybottom <- ty(x[[3]], par)
    xright <- tx(x[[4]], par)
    ytop <- ty(x[[5]], par)
    col <- FixupCol(x[[6]], NA, par$bg)
    border <- FixupCol(x[[7]], par$fg, par$bg)
    lty <- FixupLty(x[[8]], par$lty)
    lty <- ifelse(is.na(lty), par$lty, lty)
    lwd <- FixupLwd(x[[9]], par$lwd)
    lwd <- ifelse(is.na(lwd), par$lwd, lwd)
    grid.rect(xleft, ybottom, xright - xleft, ytop - ybottom,
              default.units="native", just=c("left", "bottom"),
              gp=gpar(col=border, fill=col, lty=lty, lwd=lwd,
                  lineend=par$lend, linemitre=par$lmitre,
                  linejoin=par$ljoin),
              name=grobname("rect"))
    upViewport(depth)
}

Try the gridGraphics package in your browser

Any scripts or data that you put into this service are public.

gridGraphics documentation built on Dec. 15, 2020, 5:10 p.m.