[R] R: plotting values on graphics

ben@zoo.ufl.edu ben at zoo.ufl.edu
Fri Oct 6 16:57:28 CEST 2000


  Use text().

On Fri, 6 Oct 2000, joseph d. hughes wrote:

> Everyone,
> 
> I have an array of integer values which are located on a uniform 2-D grid.  I want to plot the integer values at the node locations. The closest I have come is with the following code:
> 
> for (i in 1:ny) {
>   for (j in 1:nx) {
>   ncell <- nx*(i - 1) + j
>   ch <- as.character(ncount[ncell])
>   tx <- j*dx - dx/2
>   ty <- ny*dy - (i-1)*dy - dy/2
>   points(tx, ty, pch = ch, col = "red", bg = "yellow", cex = 3)
>   }
> }
> 
> The problem with the code above is I only get a one character symbol at each node (e.g. n=123 gives me 1 on the screen).  Is there something wrong with my as.character or points function calls?  Is there a better way to do this?
> 
> Thanks in advance,
> 
> Joseph Hughes
> jdhughes99 at mindspring.com
> 
> 
> 

-- 
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list