Skip to contents

gridsGrob() arranges several blank numberGridGrob() panels in reading order in a row/column grid filling a [0, 1] x [0, 1] viewport, inset by margin. Intended for printing practice sheets of blank number grids to hand-sketch candidate puzzle pictures on before encoding them as segments in inst/puzzles.yaml.

Usage

gridsGrob(
  n = 4L,
  ncol = NULL,
  nrow = NULL,
  margin = unit(0.25, "in"),
  r = unit(0.005, "snpc"),
  gp = gpar(col = "black", fill = "black", lwd = 2),
  name = NULL,
  vp = NULL
)

Arguments

n

Number of number grids to draw.

ncol

Number of columns of grids. The default (NULL) arranges the grids as close to a square as possible (ceiling(sqrt(n)) columns), e.g. 2x2 for 4 grids.

nrow

Number of rows of grids. The default (NULL) picks enough rows to fit n grids into ncol columns.

margin

Printer margin around the whole arrangement (a grid::unit()).

r

Radius of the circles in each grid, passed to numberGridGrob().

gp

A grid::gpar() object.

name

A character identifier (for the grob).

vp

A grid::viewport() object (or NULL).

Value

A grid::gTree() object.

Examples

# a two-sided landscape letter PDF of blank grids ready to print (duplex)
# for hand-sketching candidate puzzle pictures
if (isTRUE(capabilities("cairo")) && require("grid")) {
    f <- tempfile(fileext = ".pdf")
    cairo_pdf(f, width = 11, height = 8.5) # landscape letter
    grid.draw(gridsGrob())
    grid.newpage()
    grid.draw(gridsGrob())
    invisible(dev.off())
    unlink(f)
}
#> Loading required package: grid