Degrees to text adjustment

degrees_to_adj(
  degrees,
  top = 90,
  clockwise = FALSE,
  expand = 0,
  bias_side = 3,
  bias_height = 1,
  plot_ranges = FALSE,
  ...
)

Arguments

degrees

numeric value for angles in degrees

top

numeric value indicating the angle at the top position

clockwise

logical indicating whether the angle increases in clockwise direction

expand

numeric value intended to expand the adjust value. For example expand=0.5 will expand the adjust value 50%.

...

additional arguments are ignored

Details

Utility function to define adj values suitable for text plotting, which arranges text relative to the angle in degrees.

Examples

degrees <- seq(from=1, to=360, by=33);
adjdf <- degrees_to_adj(degrees);
x <- cos(jamba::deg2rad(degrees));
y <- sin(jamba::deg2rad(degrees));
plot(x, y,
   pch=20, asp=1,
   xlim=c(-1.3, 1.3),
   ylim=c(-1.3, 1.3));
for (i in seq_along(degrees)) {
   text(labels=i,
      x=x[i], y=y[i],
      adj=unlist(adjdf[i,]))
}