[R] Ploting NA location points

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Aug 11 10:30:46 CEST 2000


r.e.darnell at ncl.ac.uk (R.E. Darnell) writes:

> Kenneth Cabrera <krcabrer at epm.net.co> writes:
> 
> 
> [...]
> 
> > 
> > How can I plot a x,y coordinates, but to plot a "z" variable
> > with a different color if it is a z missing value (NA)?
> plot(x[!is.na(z)],y[!is.na(z)],xlim=range(x),ylim=range(y))
> points(x[is.na(z)],y[is.na(z)],col=2)

Easier:

plot(x,y,color=ifelse(is.na(z),"red","black"))

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list