[R] Plotting colour-coded points
dwinsemius at comcast.net
Wed Jan 5 20:32:07 CET 2011
On Jan 5, 2011, at 2:00 PM, ANJAN PURKAYASTHA wrote:
> I have a file of the following type:
> id a b
> 1 0.5 5
> 2 0.7 15
> 3 1.6 7
> 4 0.5 25
> I would like to plot the data in column a on the y-axis and the
> corresponding data in column id on the x-axis, so plot(a~id).
> However I
> would like to colour these points according to the data in column b.
> column b data may be colour coded into the following bins: 0-9; 10-19;
> Any idea on how to accomplish this?
Something along the lines of this code:
plot(a ~ id, data=dfrm,
col=c("red", "green", "blue")[findInterval(dfrm$b,
c(0,10,20,30) )] )
> anjan purkayastha, phd.
> research associate
> fas center for systems biology,
> harvard university
> 52 oxford street
> cambridge ma 02138
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help