inst/test-scripts/test-clip.R

library(gridGraphics)

clip1 <- function() {
    set.seed(1)
    x <- rnorm(1000)
    hist(x, xlim = c(-4,4))
    usr <- par("usr")
    clip(usr[1], -2, usr[3], usr[4])
    hist(x, col = 'red', add = TRUE)
    clip(2, usr[2], usr[3], usr[4])
    hist(x, col = 'blue', add = TRUE)
}

plotdiff(expression(clip1()), "clip-1")

plotdiffResult()

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.