Skip to contents

Truncate log-scaled axis breaks to data range

Usage

limit_breaks(v, n = 5, splits = 1, base = exp(1))

Arguments

v

Numeric vector, data or data range

n

Scalar, target number of breaks

splits

Integer, one of c(1,2,3). How many tick marks per "decade?"

base

a positive or complex number: the base with respect to which logarithms are computed. Defaults to \(e\)=exp(1).

Value

Vector of numeric values for axis breaks

See also

Other breaking: breaks_divMult(), limitimil(), split_decades()

Examples

dat <- exp(seq(-2,5,0.2))
v <- log(dat) # data or data range
n <- 5
# axisTicks returns values way beyond data
grDevices::axisTicks(nint = n, log = TRUE, usr = range(v))
#> [1] 1e-02 1e-01 1e+00 1e+01 1e+02 1e+03 1e+04 1e+05
# limit_breaks reels this in
limit_breaks(v = v, n = n)
#> [1] 1e-02 1e+05