[R] Use of colour in plots

John Kane jrkrideau at yahoo.ca
Fri Sep 5 16:24:35 CEST 2008


Here is an example doing the same type of thing.  
It should be easy enough to adapt. 

Good luck

===========================================================
x <- runif(100, 0, 1)
y <- runif(100, 0, 1)
z <- data.frame(x,y)

 plot(subset(z, z$y >=.5), col="red", ylim=c(min(z$y),
 max(z$y)), pch=16) 
 points(subset(z, z$y <=.49), col="blue", pch=16)
===========================================================


--- On Fri, 9/5/08, Steve Murray <smurray444 at hotmail.com> wrote:

> From: Steve Murray <smurray444 at hotmail.com>
> Subject: [R] Use of colour in plots
> To: r-help at r-project.org
> Received: Friday, September 5, 2008, 9:10 AM
> Dear all,
> 
> I have 3 datasets all of which share the same longitude and
> latitude values, which I'm looking to plot onto a
> scattergraph. The third dataset has values which can only be
> either '1' or '2'. So to incorporate all
> three datasets onto two axes, I'm wondering if I can
> plot dataset1 and dataset2 as normal, but then use colour to
> determine whether these points are either values '1'
> or '2' according to the third dataset.
> 
> If so, how would I go about doing this in R, and what
> format would the command take?
> 
> Thanks for any help offered,
> 
> Steve
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.



More information about the R-help mailing list