pos2adj: Convert a "directional" position to "adj" values for labeling...

View source: R/pos2adj.R

pos2adjR Documentation

Convert a "directional" position to "adj" values for labeling a point.

Description

Convert a “directional” (e.g., ‘NE’, ‘S’, etc.) position to “adj” values for labeling a point.

Usage

pos2adj(
  pos = c("center", "S", "W", "N", "East", "SW", "NW", "NE", "SE", "s", "w", "n", "east",
    "sw", "nw", "ne", "se"),
  offset = 0.5
)

Arguments

pos

A string that indicates a direction to place the label relative to a set of coordinates.

offset

A value that controls how far the label will be from the point (0=label starts on point).

Value

A vector of length two that contains the x- and y-coordinate adjustment values such that a label will be placed according to the “directional” position. The results from this function would be set equal to the adj= argument in text().

Author(s)

Derek H. Ogle, dogle@northland.edu

See Also

text.

Examples

## Make a dummy plot
plot(c(0.75,2,3.25),c(2,2,2),xlim=c(0,4),ylim=c(1,3),pch=16,xlab="x",ylab="y")

## Add some labels
text(2,2,"center",adj=pos2adj())
text(0.75,2,"north",adj=pos2adj("N"))
text(0.75,2,"south",adj=pos2adj("S"))
text(0.75,2,"east",adj=pos2adj("E"))
text(0.75,2,"west",adj=pos2adj("W"))
text(3.25,2,"NE",adj=pos2adj("NE"))
text(3.25,2,"NW",adj=pos2adj("NW"))
text(3.25,2,"SE",adj=pos2adj("SE"))
text(3.25,2,"SW",adj=pos2adj("SW"))


droglenc/FSAmisc documentation built on Jan. 8, 2023, 12:59 a.m.