Skip to contents

numberGridGrob() creates a grid grob of a 10x10 grid of (small) circles representing the numbers 1 to 100 (in reading order). The left side is labelled with the numbers 1, 11, ..., 91 (right-aligned), the right side with the numbers 10, 20, ..., 100 (right-aligned), and the top with the numbers 1, 2, ..., 10. It is intended to be drawn within a square viewport.

Usage

numberGridGrob(
  segments = list(),
  r = unit(0.005, "snpc"),
  gp = gpar(col = "black", fill = "black", lwd = 2),
  name = NULL,
  vp = NULL
)

Arguments

segments

A list of numeric vectors of numbers from 1 to 100. For each numeric vector we'll draw line segments between each (consecutive) number in that vector (as mapped to the points in the number grid).

r

Radius of the circles.

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

if (require("grid", quietly = TRUE)) {
    grid.newpage()
    vp <- viewport(width = unit(1, "snpc"), height = unit(1, "snpc"))
    grid.draw(numberGridGrob(vp = vp))
}

if (require("grid", quietly = TRUE)) {
    grid.newpage()
    puzzle <- read_puzzles()$letter_x
    vp <- viewport(width = unit(1, "snpc"), height = unit(1, "snpc"))
    grid.draw(numberGridGrob(segments = puzzle$segments, vp = vp))
}