[R] Plot ticks and tick labels: thickness, colour?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 7 08:24:23 CEST 2003


On Wed, 6 Aug 2003, Thomas W Blackwell wrote:

> You can certainly make tickmarks thinner than the axis line by
> multiple calls to  axis() with different values for lwd.  MAYBE
> you can overwrite an earlier call by setting  col.axis="white"
> (and no tickmarks) but I've never tried this.  mtext()  allows
> building custom tick labels.

col.axis="transparent" would be better:  col.axis="white" would overplot 
in white.

> In R-1.7.1,  help("axis")  seems to disagree with  help("par")
> on whether the arguments to  axis()  are called "col" and "font"
> (as in help(axis)) or "col.axis", "col.lab" and "font.lab"
> (as in help(par)).  In my experience,  help(par)  rules.

I think there is no disagreement in the help, but your experience does
disagree with my experiments.

    font: font for text.

     col: color for the axis line and the tick marks.  The default
          'NULL' means to use 'par("fg")'.

     'col.axis' The color to be used for axis annotation.

     'col.lab' The color to be used for x and y labels.

    'font.axis' The font to be used for axis annotation.

Try

> plot(1:10, col.axis="gold", col.lab="blue", font.axis=3)
> axis(side=4, at=1:10, col="green", col.axis="gold", col.lab="blue", 
       font.axis=3, font=2)

So when calling axis, the colour of the line and the tick marks is set by 
"col" and that of the labels by "col.axis" and the xlab and ylab by 
"col.lab".  Three separate components, three colour settings.

As for fonts, "font" rules when supplied to axis, otherwise "font.axis" is 
used.

I'll add a note to axis.Rd.

BDR




More information about the R-help mailing list