[R] Newbie guide for plot & graphics functions?

Don MacQueen macq at llnl.gov
Fri Jul 15 17:06:55 CEST 2005


I think you have it backwards (the error message not withstanding). 
Read the documentation for image, note the beginning of the Details 
section, and then compare these two examples, both of which succeed 
on my system (R 2.1.1).

x <- 1:10
y <- 1:15
z <- outer(x,y)
image(x,y,z)

xb <- c(.5,x+.5)
yb <- c(.5,y+.5)
image(x,y,z)

x and y provide either the centers of the cells, or the boundaries of 
the cells. In the latter case, the lengths of x and y should be 1 
greater than the dim of z, not one less.

(I'm including my full version info to be complete, but I doubt that 
you problem has to do with your platform [OS]).

-Don

>  version
          _                       
platform powerpc-apple-darwin7.9.0
arch     powerpc                 
os       darwin7.9.0             
system   powerpc, darwin7.9.0    
status                           
major    2                       
minor    1.1                     
year     2005                    
month    06                      
day      20                      
language R                       


At 7:23 AM -0700 7/15/05, Pete Cap wrote:
>Hello all,
>
>Can anyone point me to a decent introduction to using the plotting 
>and assorted graphics functions in R?
>
>I keep getting simple errrors and I can't figure out why, for example:
>
>>  image(x,y,z)
>Error in image.default(x, y, z) : dimensions of z are not 
>length(x)(+1) times length(y)(+1)
>>  length(x)
>[1] 206
>>  length(y)
>[1] 40
>>  dim(z)
>[1] 207  41
>
>
>It seems to me as if R is wrong--the matrix z is obviously of 
>length(x)+1 times length(y)+1--but just as obviously I'm missing 
>something essential.  Are there any "newbie" guides out there for 
>getting started?
>TIA,
>
>Pete
>
>
>
>---------------------------------
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA




More information about the R-help mailing list