[R] text colour in legend

Marcus Leinweber leinwebe at eva.mpg.de
Fri Nov 5 19:57:23 CET 2004


hello,


the following example gives a plot with a legend:


plot(-10:10,-10:10,type="n")
x=1:10
y=1:10
tt=c("A","B","C","D","E","F")
text(x,y,tt,cex=.8)
legend(-10,10,paste(tt," ",x,y),text.col=c(2:4))  # each row in different  
colour

but how can I colour the legend text by "column" meaning tt in red, x in  
blue and y in green?

thanks for your help.

marcus




More information about the R-help mailing list