[R] Problems with lattice plot

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Fri Jan 18 12:17:36 CET 2008


> 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?

Be really careful with your terminology - to most R users, 'lattice plots' 
refer to plots created using the lattice package.  The function you want 
is image, or its equivalent in the lattice package, levelplot.

Regards,
Richie.

Mathematical Sciences Unit
HSL



------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list