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.

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")
#>           [,1]         [,2]
#> [1,] 0.1047647  0.002660794
#> [2,] 0.3562163 -0.178884468
#> [3,] 0.4235550  0.113130024
#> [4,] 0.2518598 -0.133022047
map_relative(x = rb, position = "right", to = wine[, 2:3])
#>          [,1]     [,2]
#> [1,] 15.49773 3.282133
#> [2,] 16.64435 2.454287
#> [3,] 16.95141 3.785873
#> [4,] 16.16848 2.663419