[R] Multiple colors in plots/lookup function

Detlef Steuer Detlef.Steuer at unibw-hamburg.de
Thu Oct 17 10:24:43 CEST 2002


On 17-Oct-2002 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]))

but this does:
 plot(zz, col=colors[zz[,3]])

detlef


> 
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _

"There is no way to peace, peace is the way." -- Ghandi

Detlef Steuer --- http://fawn.unibw-hamburg.de/steuer.html
***** Encrypted mail preferred *****
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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