harmonize_text_srt: Adjust text srt (rotation) to get readable directions

Description Usage Arguments Details Examples

View source: R/utils.R

Description

Adjust text srt (rotation) to get readable directions

Usage

1

Arguments

a

Vector of angles (anti-clockwise).

ortho

Rotate so text is orthogonal to the axis?

Details

srt values are mapped as follows: 0 to 90 = keep, 271 to 260 = keep, 91 to 270 = add 180 degrees.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
srt <- round(seq(0, 360, length=10))   # some angles

# plot text with standard rotation
plot(srt, rep(0, 10), type="n")
for (i in seq_along(srt))             
  text(srt[i], .5, label=srt[i], srt=srt[i])

# all labels in readable direction
hsrt <- harmonize_text_srt(srt)      
for (i in seq_along(srt))
  text(srt[i], 0, label=srt[i], srt=hsrt[i])

# all labels in readable direction but orthogonal to the ones before
hsrt <- harmonize_text_srt(srt, ortho = TRUE)  # harmonize rotation
for (i in seq_along(srt))
  text(srt[i],-.5, label=srt[i], srt=hsrt[i])

markheckmann/dissertation documentation built on May 21, 2019, 12:06 p.m.