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) 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. Thanks in advance, Rado -- Radoslav Bonk M.S. Dept. of Physical Geography and Geoecology Faculty of Sciences, Comenius University Mlynska Dolina 842 15, Bratislava, SLOVAKIA tel: +421 2 602 96 250 e-mail: rbonk at host.sk -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi 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) > > 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.Do you mean something like this ... ? x <- rnorm(50) y <- rnorm(50) z <- rnorm(50) pch <- rep(1, 50) pch[z < 0] <- 20 cex <- (abs(z)/max(abs(z))) * 4.9 + 0.1 plot(x, y, pch=pch, cex=cex) Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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) > > 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.> x <- rnorm(25) > y <- rnorm(25) > z <- rnorm(25) > pchs <- c(1, 20) > pchs[(z < 0)+1][1] 20 20 20 20 1 1 20 20 1 20 20 20 20 20 1 20 1 ...> plot(x, y, pch=pchs[(z < 0)+1]) > text(x, y, labels=round(z, 2), pos=1, offset=0.5)This "cuts" the z vector at zero, using the convenient slight-of-hand that TRUE and FALSE map to integers 1 and 0, and thus gives the pch argument in plot() or points() a vector of values of indices of the pchs vector. More generally, use cut() to break a numeric vector into class intervals (possibly within ordered()). Roger> > Thanks in advance, > > Rado > > -- > Radoslav Bonk M.S. > Dept. of Physical Geography and Geoecology > Faculty of Sciences, Comenius University > Mlynska Dolina 842 15, Bratislava, SLOVAKIA > tel: +421 2 602 96 250 e-mail: rbonk at host.sk > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- Roger Bivand NHH, Breiviksveien 40, N-5045 Bergen, Norway (travelling but still accessible) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I found that (0.1,0.5) was a bit small for a point-size range so I used (0.5,2.5), but otherwise I think this does what you want. n <- 20 x <- runif(n) y <- runif(n) z <- 2*runif(n)-1 cex.min <- 0.5 cex.max <- 2.5 plot(x,y,pch=ifelse(z>0,1,20),cex=cex.min+((z-min(z))/(max(z)-min(z)))*(cex.max-cex.min)) On Thu, 7 Nov 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) > > 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. > > Thanks in advance, > > Rado > >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._