new_free: Add a free polygon shape to a plot

View source: R/new_polys.R

new_freeR Documentation

Add a free polygon shape to a plot

Description

A free polygon shape is a polygon of arbitrary shape defined by any sequence of x-y pairs where the last x-y pair is connected to the first x-y pair to close the polygon.

Usage

new_free(pj, x, y, region = ".", look = NULL, mod = NULL, name = ".")

Arguments

pj

an object of class 'pj'.

x

numeric vector defining the horizontal location of each vertex. The longer of x and y must be of length 3 or greater.

y

numeric vector defining the vertical location of each vertex. The longer of x and y must be of length 3 or greater.

region

either character scalar "." to indicate the most recently used region, a positive integer to indicate the ID number of a region (0 indicates the background region), or a character scalar to indicate the name of a region ('bg' indicates the background region).

look

an optional list containing up to four lists specifying looks to apply to the shape. See the using look to make shapes appear section.

mod

an optional list containing up to four lists specifying modifications to apply to the shape. See the using mod to transform shapes section.

name

character scalar indicating a name for the shape. The special value "." indicates that the pj package create a default name for the shape.

Value

pj with the addition of the specified free polygon shape.

Argument recycling

The argument set {x, y} is recycled.

Using look to make shapes appear

By itself, this function simply defines the location of x-y pairs in the assigned region for the specified shape. Various looks can be added to the shape using the look parameter or via the add_ends, add_fills, add_glyphs, add_labels, add_lines, and add_marks functions. Sub-lists of the look argument must be named 'end', 'fill', 'glyph', 'label', 'line', and/or 'mark' to indicate that line end marks, fill colors, glyphs (single characters), labels, lines, and/or point marks be added to the shape.

Using mod to transform shapes

Shapes can be transformed in four ways: dilation, reflection, rotation, and translation/. using the mod argument or the mod_dilate, mod_reflect, mod_rotate, and mod_translate. Sub-lists of the mod argument must be named 'dilate', 'reflect', 'rotate', and/or 'translate' to indicate that a dilation, reflection, rotation, and or translation be applied to the shape.

See Also

Other new_polygons: new_polys(), new_regulars(), new_stars()


j-martineau/pj documentation built on March 19, 2022, 5:32 a.m.