logtix: Add Log-Scaled Tick Marks to an Axis

Description Usage Arguments Details Value Author(s) See Also

View source: R/logtix.R

Description

logtix() labels tick marks on a log-scaled axis at regular intervals with untransformed (linear scale) values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
logtix(
  axis = 1:2,
  major = "^(|[0\\.]+)[125]",
  plus1 = TRUE,
  base = 10,
  las = 1,
  tcl = c(-0.2, -0.1),
  plot.tix = T,
  usr,
  ticfun = function(x) x,
  labels = TRUE,
  ...
)

Arguments

axis

Numeric vector of axes to label, accepts values in 1:4.

major

Character value with regular expression indicating which ticks should should be labelled (major ticks); default will label tick marks. Default is "^(|[0\.]+)[125]" where the (linear-scale) number starts with 1, 2 or 5. Set to "" to omit tick labels.

plus1

Logical or numeric value; are values plotted as log10(x+1)? If plus1 is a value other than 0 or 1, transform as log10(x+plus1).

base

Numeric values; logarithmic base. Default is 10, use exp(1) for natural log.

las

Value specifying rientation of the tick labels– see help("par").

tcl

Numeric vector of major (tcl[1]) and minor (tcl[2]) tick lengths. Provide a single number to use the same for both major and minor.

plot.tix

logical; should the ticks be added to the current plot?.

usr

2-element numeric vector specifying axis limits; used in conjunction with ticfun to apply transformations to the axis.

ticfun

Function to map axis scales (see Notes).

labels

Logical; should tick marks be labelled at all?

...

Other arguments passed to the axis function.

Details

This function enables the user to label the axes of a plot that was generated using log-transformed data (including the case where a constant was added prior to log transformation), where the tick marks are labeled with "raw" (untransformed) values.

The usr and ticfun arguments were added to permit this function to be used with plots generated by the Hist function, by passing in the xbin or ybin function returned as an element of the list generated by Hist. This is necessary because the values of the axis generated by Hist are based on the number, width and spacing of bins, not the original data scale.

Value

Returns a list object which may have $x and $y elements, each with a named numeric vector of tick marks (on the plot scale) and labels (on linear scale) for both major and minor ticks.

Author(s)

M.W.Rowe, mwr.stats@gmail.com

See Also

par, axis for more details about plotting options.


mwrowe/microRutils documentation built on June 12, 2021, 2:41 p.m.