Skip to content
Prev 81951 / 398506 Next

suppress tick labels

On Thu, 2005-12-01 at 10:19 -0600, Paul Roebuck wrote:
That's not what Sebastian requires.

He would like the axis tick marks to be drawn, but without values at the
tickmark locations, as opposed to the axis labels.

There is not a direct way, but a possible workaround:

 plot(rnorm(20), col.axis = "white")

This sets the tick mark label color to be the same as the background,
thus unseen.

If you have an alternate background color, adjust the above accordingly.

For plot.default() specifically and functions that behave similarly
internally with respect to the axes, you could use:

  plot(rnorm(20), labels = FALSE)

where the labels argument is passed to the internal axis drawing
function. However, since 'labels' is passed as a "..." argument, you end
up with a warning about 'labels' not being able to be set in a high
level plot function, since it gets passed as a graphical par.

Ultimately however, I do think that this behavior is best controlled by
using "axes = FALSE" and then calling axis(x, labels = FALSE):

 plot(rnorm(20), axes = FALSE)
 axis(1, labels = FALSE)
 axis(2, labels = FALSE)
 box()

Non-standard plot behavior is best done outside of the default plot
function, where you have maximum flexibility.

HTH,

Marc Schwartz