Convert NPC (Normalized Parent Coordinates) into data coordinates.

npc_to_data_coord(npc, data.ranges)

Arguments

npc

a numeric vector. Each value should be in [0-1]

data.ranges

a numeric vector of length 2 containing the data ranges (minimum and the maximum)

Value

a numeric vector representing data coordinates.

See also

Examples

npc_to_data_coord(npc = c(0.2, 0.95), data.ranges = c(1, 20))
#> [1]  4.80 19.05
as_npc(c("top", "right")) %>%
   npc_to_data_coord(data.ranges = c(1, 20))
#> [1] 19.05 19.05