[R] plotting points with different colors

Ko-Kang Kevin Wang Ko-Kang at xtra.co.nz
Thu Jun 28 03:34:42 CEST 2001


Hi,

Perhaps try the c() parameter.

e.g.

> x <- 1:10
> # plot(x)
> plot( x, col = c( "red", "blue", "black", "cyan", "green", "yellow" ) )

It was only an example, I haven't specified 10 colours for the 10 x values (well it is hard to think 10 colours at once), but you get the idea :-)

Cheers,

Kevin


----------------------------------------------
Ko-Kang Kevin Wang
Head of Statistical Analysis Division
Software Developers' Klub (SDK)
University of Auckland
Auckland
New Zealand


-----Original Message-----
From: owner-r-help at stat.math.ethz.ch
[mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of M. LaMadrid
Sent: Thursday, June 28, 2001 11:38 AM
To: r-help at stat.math.ethz.ch
Cc: M. LaMadrid
Subject: [R] plotting points with different colors



I am trying to make a plot where each data point gets
plotted with a user-defined color, i.e., one set of x-y pairs, with
each point having a different color, and not, e.g., 3 sets with
3 different colors. If anyone has tried
this, I'd appreciate seeing how it's done. I have tried to
make something analogous to the way "January Pie Sales"
(from the demo("graphics") set) was done, using 'plot'
instead of 'piechart', but only the first color in the list
gets used.

Thanks for any useful advice.

M. A. LaMadrid


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

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