compute_npcx: Compute npc coordinates

View source: R/utilis.R

compute_npcxR Documentation

Compute npc coordinates

Description

Convert character-encoded positions to npc units and shift postions to avoid overlaps when grouping is active. If numeric validate npc values.

Usage

compute_npcx(x, group = 1L, h.step = 0.1, margin.npc = 0.05, each.len = 1)

compute_npcy(y, group = 1L, v.step = 0.1, margin.npc = 0.05, each.len = 1)

Arguments

x, y

numeric or character vector of coordinates.

group

integer ggplot's group id. Used to shift coordinates to avoid overlaps.

h.step, v.step

numeric ⁠[0, 1]⁠ The step size for shifting coordinates in npc units.

margin.npc

numeric ⁠[0, 1]⁠ The margin added towards the nearest plotting area edge when converting character coordinates into npc.

each.len

integer The number of steps per group.

Value

A numeric vector with values in the range ⁠[0, 1]⁠ representing npc coordinates.


rpkgs/gg.layers documentation built on Sept. 14, 2024, 11:07 p.m.