Skip to content

plotting points with different colors

3 messages · M. LaMadrid, Ko-Kang Kevin Wang, Duncan Murdoch

#
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,

Perhaps try the c() parameter.

e.g.
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Wed, 27 Jun 2001 16:38:12 -0700 (PDT), you wrote in message
<Pine.A41.4.33.0106271629260.197708-100000 at homer03.u.washington.edu>:
This gives me 10 points in 10 different colours:

  plot(1:10,1:10,col=1:10)

in R 1.3.0 for Windows.  What are you doing that's different?

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