[ top | up ]

Add an Axis to a Plot

Syntax

axis(which, at, labels=TRUE, lty="solid",
        col=par("fg"), cex=1)

Arguments

which an integer specifying which side of the plot the axis is to be drawn on.
at the points at which tick-marks are to be drawn.
labels this can either be a logical value specifying whether (numerical) annotations are to be made at the tickmarks, or a vector of character strings to be placed at the tickpoints.
lty the line texture to be used for the axis.
col the color for the axis labels.
cex the expansion factor for the axis labels.

Description

axis adds an axis to an already existing plot. The axis is placed as follows: 1=below, 2=left, 3=above and 4=right.

Examples

plot(1:4, rnorm(4), axes=FALSE) axis(1, 1:4, c("A", "B", "C", "D")) axis(2)