s-news
[Top] [All Lists]

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

To: "Khan, Sohail" <khan@cshl.edu>
Subject: Re: Color code Scatter Plot.......
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Wed, 24 Aug 2005 09:17:49 -0500
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <C8696843AE995F4EA4CDC3E2B83482A90DDD18@mailbox02.cshl.edu>
Organization: PDF Solutions, Inc.
References: <C8696843AE995F4EA4CDC3E2B83482A90DDD18@mailbox02.cshl.edu>
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)


Khan, Sohail 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.


Very easily in trellis.

xyplot(Y ~ X, data = my.data, groups = Chr)

where "my.data" is your data.frame containing "X", "Y", and "Chr".

I'll let others give you direction using traditional graphics (i.e. ?plot, ?points, etc.)

--sundar

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