Re: [R] Plot ticks and tick labels: thickness, colour?
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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plot ticks and tick labels: thickness, colour?
Dirk - 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. 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. But, do you REALLY want to get into this ! - tom blackwell - u michigan medical school - ann arbor - On Wed, 6 Aug 2003, Dirk Eddelbuettel wrote: I am displaying several series in one plot, and would like to make them distinct without having to employ a legend. I managed to color tickmarks, but have been unsuccessful with either one of a) making tickmarks thicker (without increasing the axis at the same time). From reading ?axis: lty, lwd: line type, width for the axis line and the tick marks. in would appear that I cannot obtain the one _without_ the other; or b) displaying the tick label in a different colour. Again, ?axis reads col: color for the axis line and the tick marks. [..] indicates that I can only set the tick mark, not the annotation. Thanks in advance, Dirk __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plot ticks and tick labels: thickness, colour?
On Wed, 2003-08-06 at 16:30, Dirk Eddelbuettel wrote: I am displaying several series in one plot, and would like to make them distinct without having to employ a legend. I managed to color tickmarks, but have been unsuccessful with either one of a) making tickmarks thicker (without increasing the axis at the same time). From reading ?axis: lty, lwd: line type, width for the axis line and the tick marks. in would appear that I cannot obtain the one _without_ the other; or b) displaying the tick label in a different colour. Again, ?axis reads col: color for the axis line and the tick marks. [..] indicates that I can only set the tick mark, not the annotation. Any ideas or suggestions? Thanks in advance, Dirk Dirk, One possible option: # Generic plot with no tick marks or annotation plot(1:10, 1:10, axes = FALSE, ann = FALSE) # First get par(usr) to get x and y axis ranges usr - par(usr) # Now draw tick marks, using axTicks() to get # default locations # First, x axis at.x - axTicks(1) segments(at.x, usr[3], at.x, usr[3] - ((usr[4] - usr[3]) * 0.01), lwd = 2, col = red, xpd = TRUE) # Draw x axis tick mark labels mtext(at.x, at = at.x, side = 1, line = 1, col = red) # Now do the same for the y axis at.y - axTicks(2) segments(usr[1], at.y, usr[1] - ((usr[2] - usr[1]) * 0.01), at.y, lwd = 2, col = blue, xpd = TRUE) # Draw y axis tick mark labels mtext(at.y, at = at.y, side = 2, line = 1, col = blue) # put a box around the plot region box() In the above calls to segments(), adjust the '* 0.01' to be the tick mark length you wish as a proportion of the axis range and of course the 'lwd' and 'col' to your preference. If you want the tick marks inside the plot region, rather than outside, change the initial subtractions to additions. Note the use of 'xpd = TRUE', so that the tick marks are not clipped at the plot region for 'outside'. If you need to use something other than the default tick mark locations, you can always adjust 'at.x' and 'at.y' to whatever you choose. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plot ticks and tick labels: thickness, colour?
On Thu, Aug 07, 2003 at 07:24:23AM +0100, Prof Brian Ripley wrote: 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. Ah, very nice. So all I needed was col.axis. Now that I think about it, I guess I knew it was mentioned in ?par. As for fonts, font rules when supplied to axis, otherwise font.axis is used. I'll add a note to axis.Rd. Very good. Thanks, Dirk -- Those are my principles, and if you don't like them... well, I have others. -- Groucho Marx __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plot ticks and tick labels: thickness, colour?
Marc, Thanks a lot -- the axTicks(), segments() and mtext() solution looks like what I was looking for. Regards, Dirk -- Those are my principles, and if you don't like them... well, I have others. -- Groucho Marx __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help