Skip to contents

Transformations are applied in the order given in transformations. The default order here (unitizer, rescaler, nudger, rotater) differs from the default used by the arrow_head_*() functions (unitizer, rotater, rescaler, nudger). The order matters when rescale differs between x and y, because rotating then rescaling is not the same as rescaling then rotating.

Usage

transformer(
  x,
  rescale = c(1, 1),
  rotate = 0,
  nudge = 0,
  center = c(0, 0),
  degrees = FALSE,
  transformations = c("unitizer", "rescaler", "nudger", "rotater")
)

Arguments

x

a 2-column matrix

rescale

a single value or a vector with length equal to the number of columns in x

rotate

angle in radians unless degrees is true

nudge

a single value or a vector with length equal to the number of columns in x

center

a single value or a vector with length equal to the number of columns in x

degrees

if TRUE, angles are degrees instead of radians

transformations

a vector of transformation functions

Value

a matrix

Examples


xy <- matrix(c(0,0,1,1), nrow = 2)
transformer(xy, transformations = "rotater", rotate = pi)
#>               [,1] [,2]
#> [1,] -1.224647e-16   -1
#> [2,] -1.224647e-16   -1