s-news
[Top] [All Lists]

Re: Color code Scatter Plot.......

To: "Mario Cortina Borja" <M.Cortina@ich.ucl.ac.uk>, <s-news@lists.biostat.wustl.edu>
Subject: Re: Color code Scatter Plot.......
From: "Khan, Sohail" <khan@cshl.edu>
Date: Wed, 24 Aug 2005 10:57:44 -0400
Thread-index: AcWouPOHGHUNbDu1QUq92KHxatz5cgAAxxbA
Thread-topic: [S] Color code Scatter Plot.......
Thank you very much Mario.........this is exactly what I was looking for.
 
-Sohail
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu]On Behalf Of Mario Cortina Borja
Sent: Wednesday, August 24, 2005 10:44 AM
To: s-news@lists.biostat.wustl.edu
Subject: Re: [S] Color code Scatter Plot.......

Dear Sohail,

Probably there are better ways of doing it - one possibility is:

plot(df1$X, df1$Y, type='n')
for (i in unique(df1$Chr)) points(df1$X[df1$Chr==i],df1$Y[df1$Chr==i],col=i)

Best wishes,

Mario

At 10:09 AM 8/24/2005 -0400, you wrote:
Dear S-plus users,
I have a data frame something like:
Chr    X        Y
1       10       5
1        8.5     12
1         6       3
2         15      22
2         25      10
2         9         5
3         10       12
3         29       41


I want to create a scatter plot of X,Y, "color coded" based on the column Chr.  I.E. chr1=red,chr2=green, chr3=yellow, so on.......
Can this be done in S-PLUS??  I would appreciate your help.
Thanks.

Sohail Khan
Scientific Programmer
COLD SPRING HARBOR LABORATORY
Genome Research Center
500 Sunnyside Boulevard
Woodbury, NY 11797
(516)422-4076

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news

_______________________
Dr Mario Cortina Borja
Senior Lecturer in Statistics
M.Cortina@ich.ucl.ac.uk  Phone +44(0)20 7905 2113 Fax +44(0)20 7905 2381
Paed. Epid. & Biostats, Institute of Child Health, UCL, London WC1N 1EH, UK

<Prev in Thread] Current Thread [Next in Thread>