[R] Multiple colors in plots/lookup function

Laurent Gautier laurent at cbs.dtu.dk
Thu Oct 17 09:18:35 CEST 2002


On Thu, Oct 17, 2002 at 12:04:17AM -0400, David Forrest wrote:
> Hello,
>   I'd like to do something like:
> 
>  n<-100
>  zz<-cbind(rnorm(n),rnorm(n),floor(runif(n)*3+1))
>  colors<-c("red","green","blue")
> 
>  plot(zz,col=colors(zz[3]))

if you replace the last line by
plot(zz,col=colors[zz[, 3]])
it seems to work.

Hopin' it helps,


L.


> 
> and have a matrix of scatterplots colored by class.  The above does not
> work, of course, but I'm not sure exactly what function I'm looking for.
> 
> Thank you for your time,
> Dave,
> -- 
>  Dave Forrest    (434)924-3954w(111B) (804)642-0662h (804)695-2026p
>  drf5n at virginia.edu             http://mug.sys.virginia.edu/~drf5n/
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
--------------------------------------------------------------
Laurent Gautier			CBS, Building 208, DTU
PhD. Student			DK-2800 Lyngby,Denmark	
tel: +45 45 25 24 89		http://www.cbs.dtu.dk/laurent
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list