Functions compute_npcx and compute_npcy convert
character-encoded positions to npc units and shift positions to avoid
overlaps when grouping is active. If numeric, they validate the npc values.
Function compute_npcx does the translation either for both x
and y aesthetics, but does not implement a shift for grpups.
Functions as_npcx(), as_npcy() and as_npc() are
wrappers on these functions that return the value as objects of class
"AsIs" so that in 'ggplot2' >= 3.5.0 they can be used with any layer
function.
These functions use NPC (Normalised Parent Coordinates) instead of data
coordinates. They translate named positions into numeric values in [0..1]
and they can also shift the position according to the group, e.g., for each
increase in the group number displace the position inwards or outwards, by
a user-supplied distance. They make it possible to set automatically set
default positions for grouped text labels.
Out of bounds numeric values are constrained to [0..1]. Unrecognized
character values are silently converted into NA_integer_.