[R] axis tick colors: only one value allowed?
Carl Witthoft
carl at witthoft.com
Tue Dec 13 01:40:29 CET 2011
Hi,
So far as I can tell, the 'col.ticks' parameter for axis() only uses the
first value provided. E.g.:
plot(0:1,0:1, col.ticks=c('blue','red','green')) #all ticks are blue
Just wondering if there's a different option in the basic plot commands
that can handle multiple colors, and also whether ggplot and/or lattice
allow for multiple tick colors.
Background: I ran into this limit while trying to colorize the ticks as
plotted by rug() . There's an easy workaround, as the output of rug()
can be duplicated with something along the lines of
> points(mydata, rep(0.5, length(mydata)),
col=rainbow(20)[mydata*20/max(mydata)] )
So I can create color rugplots, but do wonder about enhancements to the
plot routines (albeit pretty silly enhancements).
As another side note: calling rug() with color set to '#00000033' lets
you see dense regions as darker than sparse regions, without having to
resort to calling jitter() first.
Carl
--
Sent from my Cray XK6
"Pendeo-navem mei anguillae plena est."
More information about the R-help
mailing list