Re: [Rd] Wishlist: axis( ) could take vector of colors (PR#7930)

From: <>
Date: Sat 11 Jun 2005 - 14:17:56 GMT wrote:

> Hi,
> This is not a bug, but a simple enhancement suggestion: that axis( ) also
> allow option "col" to take a vector of colors equal to the length of
> "labels". Currently it allows it, in the sense that there is no error
> message, but the function will use just the first element of the vector.
> Example
> > plot(1:5,exp(1:5),axes=F,type="o")
> > axis(1,col=c(rep("red",2),rep("blue",3)))
> gives all red axis notation.

A color of length > 1 does not make sense here, from my point of view. Hence I'd like to object here.
It might make sense for argument "col.axis", but this is very hard to implement due to the internal structure of automatical tick mark calculations.

Most easily you can use mtext() to annotate an un-annotated axis with different colors as in:

  plot(1:10, xaxt="n")
  axis(1, at=c(2,5,8), labels=rep("", 3))   mtext(c(2,5,8), side=1, at=c(2,5,8),

        col=c("red", "green", "blue"), line=0.5)

Uwe Ligges

> Thanks,
> Elizabeth Purdom
> (Windows XP, R 2.1.0)
> ______________________________________________
> mailing list
> mailing list Received on Sun Jun 12 00:20:16 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:17 GMT