[R] Problems with lattice plot

Francesc Montané francesc.montane at ctfc.es
Fri Jan 18 12:01:29 CET 2008


Hello useRs,

 

I have some problems when I try to plot a lattice. The lattice has 200 
columns (X value) and 5 rows (Y value), with a total of 1000 squares. I 
want to plot this lattice with the squares having different colours 
according to a variable value.

 

The variable I want to plot is cover value of a shrub, and it has values 
between 0 and 1. I want to plot the squares with value 1, black, the 
squares with values 0, white, and the values between 0 and 1 with grey, 
more or less dark depending on its proximity to 1 (dark grey) or 0 
(light grey). I have tried this:

 

plot(x=transect41$x,y=transect41$y,asp=1,

xlab="",ylab="",

axes=F,pch=22,cex=1.01,lwd=0.05,

bg=gray(1-transect41$CoverValue),col=gray(0.75))

plot(pch=22,cex=1.01,lwd=0.05)

 

When I plot the lattice, I have problems because the squares have 
different sizes. Moreover, some of them look like a rectangle and not a 
square.

What can I do to solve this problem?

 

Many thanks in advance.

 

Francesc




More information about the R-help mailing list