library(grid)
library(fillpattern)
grid.newpage()
grid.rect(gp = gpar(fill = fill_pattern("brick", bg = "gray", angle = 90)))
grid.newpage()
gp <- Map(gpar, fill = fill_pattern(
patterns = c("grid_3lwd", "stripe_longdash", "herringbone45", "hexagon_lg"),
fg = c("black", "white", "black", "blue"),
bg = c("white", "black", "cyan", "beige") ))
grid.circle( gp = gp[[1]], x = 1/4, y = 3/4, r = 1/5)
grid.polygon(gp = gp[[2]], x = c(9,12,15)/16, y = c(15,9,15)/16)
grid.rect( gp = gp[[3]], x = 1/4, y = 1/4, width = 2/5, height = 2/5)
grid.rect( gp = gp[[4]], x = 3/4, y = 1/4, width = 2/5, height = 2/5)
Run the code above in your browser using DataLab