grid.pattern_polygon_tiling {gridpattern}R Documentation

Polygon tiling patterned grobs

Description

grid.pattern_polygon_tiling() draws a specified polygon tiling pattern onto the graphic device. names_polygon_tiling lists all supported types.

Usage

grid.pattern_polygon_tiling(
  x = c(0, 0, 1, 1),
  y = c(1, 0, 0, 1),
  id = 1L,
  ...,
  colour = gp$col %||% "grey20",
  fill = gp$fill %||% "grey80",
  angle = 30,
  spacing = 0.05,
  xoffset = 0,
  yoffset = 0,
  units = "snpc",
  type = "square",
  alpha = gp$alpha %||% NA_real_,
  linetype = gp$lty %||% 1,
  linewidth = size %||% gp$lwd %||% 1,
  size = NULL,
  default.units = "npc",
  name = NULL,
  gp = gpar(),
  draw = TRUE,
  vp = NULL
)

names_polygon_tiling

Arguments

x

A numeric vector or unit object specifying x-locations of the pattern boundary.

y

A numeric vector or unit object specifying y-locations of the pattern boundary.

id

A numeric vector used to separate locations in x, y into multiple boundaries. All locations within the same id belong to the same boundary.

...

Currently ignored.

colour

Stroke colour(s).

fill

Fill colour(s) or grid::pattern() / gradient object(s).

angle

Rotation angle in degrees.

spacing

Spacing between repetitions of pattern (in units units).

xoffset

Shift pattern along x axis (in units units).

yoffset

Shift pattern along y axis (in units units).

units

grid::unit() units for spacing, xoffset, and yoffset parameters.

type

Name of polygon tiling to draw. See Details.

alpha

Alpha (between 0 and 1) or NA (default, preserves colors' alpha value). Not supported for all polygon tiling type.

linetype

Stroke linetype.

linewidth

Stroke linewidth.

size

For backwards compatibility can be used to set linewidth.

default.units

A string indicating the default units to use if x or y are only given as numeric vectors.

name

A character identifier.

gp

An object of class "gpar", typically the output from a call to the function gpar. This is basically a list of graphical parameter settings.

draw

A logical value indicating whether graphics output should be produced.

vp

A Grid viewport object (or NULL).

Format

An object of class character of length 36.

Details

grid.pattern_polygon_tiling() supports 1, 2, or 3 fill colors with the first colors (weakly) covering a larger area. Size of the pattern is controlled by spacing. We support the following polygon tiling types:

elongated_triangular

Creates an elongated triangular tiling made of squares and triangles.

herringbone

Creates a herringbone tiling made of rectangles.

hexagonal

Creates a hexagonal tiling made of hexagons.

pythagorean

Creates a Pythagorean tiling made of squares of two different sizes.

rhombille

Creates a rhombille tiling made of rhombi.

rhombitrihexagonal

Creates a rhombitrihexagonal tiling made out of dodecagons, hexagons, and squares.

snub_square

Creates a snub square tiling made of squares and triangles.

snub_trihexagonal

Creates a snub trihexagonal tiling made of hexagons and triangles.

square

Creates a square tiling made of squares.

tetrakis_square

Creates a tetrakis square tiling made of isosceles right triangles.

triangular

Creates a triangular tiling made of equilateral triangles.

trihexagonal

Creates a trihexagonal tiling made of hexagons and triangles.

truncated_square

Creates a truncated square tiling made of octagons and squares.

truncated_hexagonal

Creates a truncated hexagonal tiling made of dodecagons and triangles.

truncated_trihexagonal

Creates a truncated trihexagonal tiling made of hexagons, squares, and triangles.

⁠2*.2**.2*.2**⁠

Creates a polygon tiling made of rhombi.

⁠2**.3**.12*⁠

Creates a polygon tiling made of rhombi, triangles, and twelve-pointed stars.

⁠3.3.3.3**⁠

Creates a polygon tiling made of triangles.

⁠3.3*.3.3**⁠

Creates a regular (star) polygon tiling made of triangles and three-pointed stars.

⁠3.3.3.12*.3.3.12*⁠

Creates a regular (star) polygon tiling made of triangles and twelve-pointed stars.

⁠3.3.8*.3.4.3.8*⁠

Creates a regular (star) polygon tiling made of triangles, squares, and eight-pointed stars.

⁠3.3.8*.4**.8*⁠

Creates a regular (star) polygon tiling made of triangles, four-pointed stars, and eight-pointed stars.

⁠3.4.6.3.12*⁠

Creates a regular (star) polygon tiling made of triangles, squares, hexagons, and twelve-pointed stars.

⁠3.4.8.3.8*⁠

Creates a regular (star) polygon tiling made of triangles, squares, octagons, and eight-pointed stars.

⁠3.6*.6**⁠

Creates a regular (star) polygon tiling made of triangles and six-pointed stars.

⁠4.2*.4.2**⁠

Creates a polygon tiling made of squares and rhombi.

⁠4.4*.4**⁠

Creates a regular (star) polygon tiling made of squares and four-pointed stars.

⁠4.6.4*.6⁠

Creates a regular (star) polygon tiling made of squares, hexagons, and four-pointed stars.

⁠4.6*.4.6*.4.6*⁠

Creates a regular (star) polygon tiling made of squares and six-pointed stars.

⁠4.8*.4**.8*⁠

Creates a polygon tiling of squares and eight-pointed stars.

⁠6.6*.6.6*⁠

Creates a regular (star) polygon tiling made of hexagons and six-pointed stars.

⁠8.4*.8.4*⁠

Creates a regular (star) polygon tiling made of octagons and four-pointed stars.

⁠9.3.9.3*⁠

Creates a regular (star) polygon tiling made of triangles, nonagons, and three-pointed stars.

⁠12.3*.12.3*⁠

Creates a regular (star) polygon tiling made of dodecagons and three-pointed stars.

⁠12.12.4*⁠

Creates a regular (star) polygon tiling made of dodecagons and four-pointed stars.

⁠18.18.3*⁠

Creates a regular (star) polygon tiling made of eighteen-sided polygons and three-pointed stars.

Value

A grid grob object invisibly. If draw is TRUE then also draws to the graphic device as a side effect.

See Also

The tiling vignette vignette("tiling", package = "gridpattern") for more information about these tilings as well as more examples of polygon tiling using the grid.pattern_regular_polygon() function.

Examples

print(names_polygon_tiling)

x_hex <- 0.5 + 0.5 * cos(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6))
y_hex <- 0.5 + 0.5 * sin(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6))
gp1 <- grid::gpar(fill = "yellow", col = "black")
gp2 <- grid::gpar(fill = c("yellow", "red"), col = "black")
gp3 <- grid::gpar(fill = c("yellow", "red", "blue"), col = "black")

grid.pattern_polygon_tiling(x_hex, y_hex, type = "herringbone", gp = gp1)

grid::grid.newpage()
grid.pattern_polygon_tiling(x_hex, y_hex, type = "hexagonal",
                            spacing = 0.2, gp = gp3)

grid::grid.newpage()
grid.pattern_polygon_tiling(x_hex, y_hex, type = "pythagorean",
                            spacing = 0.2, gp = gp2)

grid::grid.newpage()
grid.pattern_polygon_tiling(x_hex, y_hex, type = "snub_trihexagonal",
                            spacing = 0.2, gp = gp3)

grid::grid.newpage()
grid.pattern_polygon_tiling(x_hex, y_hex, type = "rhombille",
                              spacing = 0.2, gp = gp3)

[Package gridpattern version 1.2.2 Index]