Skip to content

lattice plotting character woes

1 message · Murray Jorgensen

#
Hi Rolf, Hi Mark, Hi List,

I have not digested Rolf's response yet. It may well answer my problems.

In the meantime I have some reproducible  code which actually shows my 
problem:


patches <-

structure(list(URBAN_AREA = structure(c(2L, 19L, 23L, 2L, 19L,

23L, 2L, 19L, 23L, 2L, 19L, 23L), .Label = c("CENTRAL AUCKLAND ZONE",

"CHRISTCHURCH", "DUNEDIN", "HAMILTON ZONE", "HASTINGS ZONE",

"INVERCARGILL", "LOWER HUTT ZONE", "mean", "NAPIER ZONE", "NELSON",

"NEW PLYMOUTH", "NORTHERN AUCKLAND ZONE", "PALMERSTON NORTH",

"PORIRUA ZONE", "ROTORUA", "SD", "SE", "SOUTHERN AUCKLAND ZONE",

"TAURANGA", "WANGANUI", "WELLINGTON ZONE", "WESTERN AUCKLAND ZONE",

"WHANGAREI"), class = "factor"), NO_PATCHES = c(11L, 16L, 21L,

87L, 192L, 324L, 164L, 417L, 773L, 679L, 757L, 3083L), MEAN_AREA = 
c(9.623631225,

15.29089619, 149.2063532, 14.1676, 247.5262, 28.611, 11.5698,

221.0022, 37.3725, 11.918, 133.5804, 25.6759), AREA.ZONE = c(13683,

3666, 1558, 64830, 41103, 22581, 123819, 90107, 57627, 264735,

223963, 174456), Buffer.zone = c(0L, 0L, 0L, 5L, 5L, 5L, 10L,

10L, 10L, 20L, 20L, 20L)), .Names = c("URBAN_AREA", "NO_PATCHES",

"MEAN_AREA", "AREA.ZONE", "Buffer.zone"), class = "data.frame", 
row.names = c(2L,

15L, 19L, 22L, 36L, 40L, 42L, 56L, 60L, 62L, 76L, 80L))



library(lattice)

Region = factor(patches$URBAN_AREA)

lpatches = patches

for (i in 2:4) lpatches[,i] = log10(patches[,i])

# zone not transformed

lpatches.pca = princomp(lpatches[,-c(1,17)],cor=FALSE)

x = lpatches.pca$scores[,1]

y = lpatches.pca$scores[,2]

zz = as.character(patches$Buffer.zone/5)

table(zz)

plsy <- trellis.par.get("plot.symbol")
# only 0 or 1 used as plotting symbol

plsy$pch = as.character(rep(1:6,2))
trellis.par.set("plot.symbol",plsy)
xyplot(y ~ x |Region)

# only 1,2,3,4 used as plotting symbol

I actually wish 0,1,2, or 4 to be used - to indicate the zone coded in zz.

Cheers,  Murray

PS The xyplots produced on R 2.7.0 for Mac OS X, the first one also on 
an older Windows version.
Rolf Turner wrote: