logAxis: Add a pretty log axis to a plot

View source: R/misc.R

logAxisR Documentation

Add a pretty log axis to a plot

Description

Adds a log axis to the current plot with log='x' or log='y' with ticks and labels specified with powers of 10

Usage

logAxis(
  side = 2,
  exponent = TRUE,
  addExtra = !exponent,
  minorTcl = -0.2,
  axisMin = -Inf,
  axisMax = Inf,
  offset = 0,
  col.ticks = "black",
  axisVals = NULL,
  ...
)

Arguments

side

an integer specifying which side of the plot the axis is to be drawn on. The axis is placed as follows: 1=below, 2=left, 3=above and 4=right.

exponent

If true label sides using exponents of 10. Otherwise just use normal numbers

addExtra

If true add additional labels at 5 or 2 if there are few labels

minorTcl

Length of the minor unlabelled ticks. NA to suppress

axisMin

The minimum to extend ticks to

axisMax

The maximum to extend ticks to

offset

An integer giving the amount to offset labels from their true position. For example, offset=1 if the plotted data was generated by adding to 1 to avoid 0s in the original data.

col.ticks

colors for the tick marks

axisVals

log10 values to be displayed on y axis (instead of autogenerated)

...

Additional arguments to axis

Value

An invisible list containing the minor and major axis label positions

Examples

plot(1:1000,log='xy',xaxt='n',yaxt='n')
logAxis(las=1)
logAxis(1,exponent=FALSE)

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