log_ticks: Logarithmic tick marks

Description Usage Arguments Value Examples

View source: R/log_ticks.R

Description

Calculate the position of major and minor ticks for a log10 axis.

Usage

1

Arguments

x

The values of the axis in question.

log

Logical indicating if x is already logarithmic. Defaults to FALSE.

Value

A list containing a vector each of the major and minor tick mark positions which is intended to be used in conjuncton with axis, see examples.

Examples

1
2
3
4
5
6
7
8
9
x <- 10^seq(1, 4, length.out = 100)
ticks <- log_ticks(x)
plot(x, stats::rnorm(100), log = "x", xaxt = "n")
axis(1, at = ticks$major_ticks)
axis(1, at = ticks$minor_ticks, labels = FALSE, tcl = -0.25)

# Use log = TRUE for input that is already logarithmic:
x2 <- log10(x)
ticks2 <- log_ticks(x2, log = TRUE)

BastiHz/BastiHzR documentation built on March 24, 2021, 1:48 p.m.