decaxis: draw axes with different decimals in the labels

Description Usage Arguments Details Value Examples

View source: R/decaxis.R

Description

draw axes with different decimals in the labels

Usage

1
decaxis(xside, xat = c(0, 0.2, 0.4, 0.6, 0.8, 1), ...)

Arguments

xside

numeric, side on which to draw the axis

xat

numeric, locations to draw ticks and labels

...

other arguments to be passed on from the axis function

Details

the function draws an axis such that integer numbers along a sequence are printed as such integer labels, e.g. "0" instead of "0.0"

Value

draws an axis on an existing plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot(runif(10), runif(10), axes = FALSE, xlim = c(0, 1), ylim = c(0, 1))
decaxis(xside = 1, las = 1, cex.axis = 0.7)
decaxis(xside = 2, las = 1, col = "red", xat = c(0, 0.5, 1))
decaxis(xside = 3, xat = c(0.1, 0.75), col.axis = "gold")
box()

plot(-2:2, -2:2, axes = FALSE)
# normal axis
axis(1, at = seq(-2, 2, 0.5))
# axis with "0 decimals" removed
decaxis(2, xat = seq(-2, 2, 0.5), las = 1)
box()

gobbios/radagio documentation built on Dec. 26, 2019, 6:13 p.m.