Skip to content
Prev 43113 / 398506 Next

Axes Ticks

On Thu, 2004-01-22 at 12:32, ivo welch wrote:
Use 'xaxt' in the call to plot() and then use axis() to control the axis
tick marks and labels:

y <- c(-4, 3, -2, 1)
x <- c(1:4)

# Do not plot the x axis
plot(x, y, type = "b", xaxt = "n")

# Now draw the x axis with text labels
axis(1, at = 1:4, labels = paste("Time", 1:4, sep = " "))

See ?par (xaxt) and ?axis for more information.

You can also use:

plot(x, y, axes = FALSE)

and then use axis(1, ...) and axis(2, ...) if you want to control both
the x and y axes, respectively.

HTH,

Marc Schwartz