mod_rotate: Add a rotation modification to a shape

View source: R/add_mod.R

mod_rotateR Documentation

Add a rotation modification to a shape

Description

A rotation modification rotates a shape around a reference point. Rotations are not valid for refline shapes.

Usage

mod_rotate(
  pj,
  ref = "c",
  x = NA,
  y = NA,
  a = NA,
  au = "r",
  shape = ".",
  name = "."
)

Arguments

pj

an object of class 'pj'.

ref

NA or a character vector identifying pre-defined reference points. See the the ref argument section.

x

NA or a numeric vector indicating the horizontal location of a point around which to rotate shapes.

y

NA or a numeric vector indicating the vertical location of a point around which to rotate shapes.

a

NA or a numeric vector indicating the angle of rotation.

au

NA or a character vector indicating the angle units to be used where 'd' indicates degrees, 'g' indicates gradians, 'p' indicates proportion of a full revolution, and 'r' indicates radians.

shape

character scalar indicating the type of shape to which the mod will be applied.

name

character scalar name to give to the specified mod. The special value "." indicates that the pj package should create a default name for the mod.

Value

pj with the rotation modification applied to the specified shape.

The ref argument

  • 'c' indicates center point of a shape's bounding rectangle.

  • 'o' indicates the origin (0, 0).

  • 'bl' indicates the bottom-left corner of a shape's bounding rectangle.

  • 'br' indicates the bottom-right corner of a shape's bounding rectangle.

  • 'tl' indicates the top-left corner of a shape's bounding rectangle.

  • 'tr' indicates the top-right corner of a shape's bounding rectangle.

  • 'lm' indicates the mid-point of the left edge of a shape's bounding rectangle.

  • 'rm' indicates the mid-point of the right edge of a shape's bounding rectangle.

  • 'bm' indicates the mid-point of the bottom edge of a shape's bounding rectangle.

  • 'tm' indicates the mid-point of the top edge of a shape's bounding rectangle.

Argument recycling

The argument set {ref, x, y, a, au, xu, yu} is recycled with the number of subshapes defined for a given shape. For point, area, and ribbon shapes, all arguments in the set must be scalar. For segment shapes, arguments in the set must be recyclable with the number of segments defined by that shape. For shapes that define polygons, arguments in the set must be recyclable with the number of polygons defined by the shape.

See Also

Other add_mod: mod_dilate(), mod_reflect(), mod_translate()


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