Learn R Programming

lmomco (version 2.4.14)

add.log.axis: Add a Polished Logarthimic Axis to a Plot

Description

This function provides special support for adding superior looking base-10 logarithmic axes relative to R's defaults, which are an embarassment. The Examples section shows an overly elaborate version made by repeated calls to this function with a drawback that each call redraws the line of the axis so deletion in editing software might be required. This function is indexed under the “lmomco functions” because of its relation to add.lmomco.axis and is not named add.lmomcolog.axis because such a name is too cumbersome.

Usage

add.log.axis(make.labs=FALSE, logs=c(2, 3, 4, 5, 6, 7, 8, 9), side=1,
             two.sided=FALSE, label=NULL, x=NULL, col.ticks=1, ...)

Value

No value is returned, except if argument x is given, for which nice axis limits are returned. By overall design, this function is used for its side effects.

Arguments

make.labs

A logical controlling whether the axis is labled according to the values in logs.

logs

A numeric vector of log-cycles for which ticking and (or) labeling is made. These are normalized to the first log-cycle, so a value of \(3\) would spawn values such as \(\cdots, 0.03, 0.3, 3, 30, \cdots\) through a range exceeding the axis limits. The default anticipates that a second call to the function will be used to make longer ticks at the even log-cycles; hence, the value 1 is not in the default vector. The Examples section provides a thorough demonstration.

side

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

two.sided

A logical controlling whether the side oppose of side also is to be drawn.

label

The label (title) of the axis, which is placed by a call to function mtext, and thus either the xlab or ylab arguments for plot should be set to the empty string "".

x

This is an optional data vector (untransformed!), which will compute nice axis limits and return them. These limits will align with (snap to) the integers within a log10-cycle.

col.ticks

This is the same argument as the axis function.

...

Additional arguments to pass to axis.

Author

W.H. Asquith

See Also

add.lmomco.axis