[R] Highlight Points in a Plot

David Winsemius dwinsemius at comcast.net
Mon May 3 21:43:34 CEST 2010

On May 3, 2010, at 3:16 PM, SamT wrote:

> For simplicity we'll assume my code looks as follows
> plot(ecdf(1:1000))
> which produces a diagonal line.
> Ideally, I'd like to highlight or label in a different color certain X
> values (say 50,55,60,65)
> Is there a function which will allow me to do this?

Yes, ecdf() which returns a function

points(c(50,55,60,65), ecdf(1:1000)( c(50,55,60,65) ), col=c("red",  
"green", "yellow", "blue") )

Draws colored points.

Could also use text() with same coordinates provided by a  
"highlightvector" and ecdf(datavector)(highlightvector).

> -- 
> View this message in context: http://r.789695.n4.nabble.com/Highlight-Points-in-a-Plot-tp2124224p2124469.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list