[R] negative and positive values in diff. colors

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Nov 7 22:27:20 CET 2002

Rado Bonk wrote:
> Hi R-users,
> I have a set of elevation residuals as geodata points. I would like to
> display them in the following way:
> -negative values using pch=20 (filled circle)
> -positive values using pch=1  (empty circle)

I'm not sure if I understand your question completely, but I guess you
want to vectorize as in:

 x <- 1:10
 y <- 1:10
 res <- -4:5
 plot(x, y, pch = ifelse(res < 0, 20, 1))

> while using the cex.max=5, cex.min=0.1 for points() to represent the
> residuals value. Basically I would like to distinguish neagtive and
> positive values at my map. How to do this.

points() doesn't know about any arguments called cex.min and cex.max.
If I guess right, you want to extend the above as in:

 plot(x, y, pch = ifelse(res < 0, 20, 1), 
   cex = (4.9 * abs(res) / max(abs(res)) + 0.1))

Uwe Ligges
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