map_relative: Returns the axis scale and position.

View source: R/0_util.r

map_relativeR Documentation

Returns the axis scale and position.

Description

Internal function. Typically called by other functions to scale the position of the axes data.frame or another data.frame to plot relative to the data.

Usage

map_relative(
  x,
  position = c("center", "left", "right", "bottomleft", "topright", "off", "top1d",
    "floor1d", "bottom1d", "full", "facetleft", "facetright", "facettop", "facetbottom"),
  to = NULL
)

Arguments

x

Numeric matrix or data.frame, first 2 columns and scaled and offset the to object.

position

Text specifying the position the axes should go to. Defaults to "center" expects one of: c("center", "left", "right", "bottomleft", "topright", "off", "full", "top1d", "floor1d", "bottom1d", "full", "facetleft", "facetright", "facettop", "facetbottom").

to

Data.frame to scale to. Based on the min/max of the first 2 columns. If left NULL defaults to data.frame(x = c(0, 1), y = c(0, 1).

Value

Transformed values of x, dimension and class unchanged.

See Also

map_absolute for more manual control.

Other linear mapping functions: map_absolute()

Examples

## !!This function is not meant for external use!!
rb <- tourr::basis_random(4, 2)

map_relative(x = rb, position = "bottomleft")
map_relative(x = rb, position = "right", to = wine[, 2:3])

spinifex documentation built on May 29, 2024, 1:23 a.m.