Remove plot axis values Remove plot axis values r r

Remove plot axis values


Remove numbering on x-axis or y-axis:

plot(1:10, xaxt='n')plot(1:10, yaxt='n')

If you want to remove the labels as well:

plot(1:10, xaxt='n', ann=FALSE)plot(1:10, yaxt='n', ann=FALSE)


Using base graphics, the standard way to do this is to use axes=FALSE, then create your own axes using Axis (or axis). For example,

x <- 1:20y <- runif(20)plot(x, y, axes=FALSE, frame.plot=TRUE)Axis(side=1, labels=FALSE)Axis(side=2, labels=FALSE)

The lattice equivalent is

library(lattice)xyplot(y ~ x, scales=list(alternating=0))


@Richie Cotton has a pretty good answer above. I can only add that this page provides some examples. Try the following:

x <- 1:20y <- runif(20)plot(x,y,xaxt = "n")axis(side = 1, at = x, labels = FALSE, tck = -0.01)