[R] How to show the intermediate tick marks without the values in a different color
Marc Schwartz
MSchwartz at mn.rr.com
Fri Mar 3 04:02:24 CET 2006
On Thu, 2006-03-02 at 20:06 -0600, xpRt.wannabe wrote:
> Is there a way to show also the intermediate tick marks without the
> values?
>
> Example:
>
> plot(cars)
>
> What would one do to show the tick marks in, say, gray color at the
> increment of 1 without showing the actual values in-between the default
> x
> values: 5, 10, 15, 20, 25?
Try this:
# Do the plot without the x axis
plot(cars, xlim = c(0, 25), xaxt = "n")
# Do the x axis in grey with tick marks at 0:25
# without labels
axis(1, at = 0:25, labels = NA, col = "grey")
# Now do the default tick marks in black with labels
axis(1)
See ?plot.default, ?par (for 'xaxt') and ?axis for more information.
HTH,
Marc Schwartz
More information about the R-help
mailing list