log10_ticks {stressaddition} | R Documentation |
Logarithmic axis tick marks
Description
Calculate the positions and labels of major and minor tick marks for a base 10 logarithmic axis.
Usage
log10_ticks(x, label_zero = TRUE)
Arguments
x |
A vector of axis values. Can be arbitrarily long but only the minimum and maximum are necessary. |
label_zero |
Whether or not to replace the smallest major label with
"0". This defaults to |
Value
A list with the positions and labels of the major and minor tick
marks. The labels are formatted without trailing zeros using
formatC(labels, format = "fg")
.
Examples
x <- c(0.01, 0.2, 3, 10, 50)
plot(x, c(5, 4, 2.5, 1, 0), xaxt = "n", log = "x")
ticks <- log10_ticks(x)
axis(1, at = ticks$major, labels = ticks$major_labels)
axis(1, at = ticks$minor, labels = FALSE, tcl = -0.25)
[Package stressaddition version 3.1.0 Index]