[R] multi-color plot
    Saurav Pathak 
    saurav at sas.upenn.edu
       
    Thu Feb 13 04:43:09 CET 2003
    
    
  
Thus spake Sundar Dorai-Raj:
+  R> plot(x=1:26,y=rep(0:1,13),type="n")
+  R> text(x=1:26,y=0.5,labels=letters,col=terrain.colors(26))
now i get it.  what i am doing now is:
R> mycol <- cls
R> mycol[mycol==0] <- "red"
R> mycol[mycol==1] <- "blue"
R> mycol[mycol==2] <- "green"
R> plot(x, y, type="n")
R> text(x, y, labels=cls, col=mycol)
which is exactly what i wanted.
thanks!!
saurav
    
    
More information about the R-help
mailing list