slantAxis: Label axis with slanted labels

View source: R/misc.R

slantAxisR Documentation

Label axis with slanted labels

Description

Label axis with slanted labels

Usage

slantAxis(
  side,
  at,
  labels = at,
  srt = ifelse(side %in% c(1, 4), -45, 45),
  location = 1.2,
  adj = ifelse(side == 2, 1, 0),
  axisArgs = list(),
  textOffsets = rep(0, length(at)),
  ...
)

Arguments

side

an integer specifying which side to draw axis on. 1=bottom, 2=left, 3=top and 4=right.

at

locations for ticks and labels

labels

character vector of tick labels

srt

a numeric specifying string rotation in degrees

location

an integer specifying the line to start the text

adj

one or two values in [0, 1] which specify the x (and optionally y) adjustment of the labels. On most devices values outside that interval will also work.

axisArgs

a list of additional arguments for axis

textOffsets

a vector of the same length at giving offsets in user coordintes for the labels

...

additional arguments to text

Examples

par(mar=c(8,8,8,8))
plot(1:10,xlab='',ylab='',xaxt='n',yaxt='n')
labels<-c('A label','Another label','A longer longer label','A really really\nlong label')
slantAxis(1,seq(2,8,2),labels)
slantAxis(2,seq(2,8,2),labels)
slantAxis(3,seq(2,8,2),labels)
slantAxis(4,seq(2,8,2),labels,srt=-30,cex=.8,axisArgs=list(col.ticks='red'),lwd=2)

sherrillmix/dnar documentation built on July 18, 2022, 10:07 p.m.