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

ligges@statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Sat Jun 11 16:17:56 CEST 2005

epurdom at stanford.edu 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 

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)
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list