| map.groups {maptree} | R Documentation |
Map Groups of Observations
Description
Draws maps of groups of observations created by clustering, classification or regression trees, or some other type of classification.
Usage
map.groups (pts, group, pch=par("pch"), size=2, col=NULL,
border=NULL, new=TRUE)
Arguments
pts |
matrix or data frame with components |
group |
vector of integer class numbers corresponding to
|
pch |
symbol number from |
size |
size in cex units of point symbol. |
col |
vector of fill colors from |
border |
vector of border colors from |
new |
if |
Details
If the number of rows of pts is not equal to the length
of group, then (1) pts are assumed to represent
polygons and polygon is used, (2) the identifiers in
group are matched to the polygons in pts through
names(group) and pts$x[is.na(pts$y)], and (3) these
identifiers are mapped to dense integers to reference colours.
Otherwise, group is assumed to parallel pts, and,
if pch < 100, then points is used, otherwise
ngon, to draw shaded polygon symbols for each
observation in pts.
Value
The vector of fill colors supplied or generated.
Author(s)
Denis White
See Also
ngon,
polygon,
group.clust,
group.tree,
map.key
Examples
data (oregon.bird.names, oregon.env.vars, oregon.bird.dist)
data (oregon.border, oregon.grid)
# range map for American Avocet
spp <- match ("American avocet", oregon.bird.names[["common.name"]])
group <- oregon.bird.dist[,spp] + 1
names(group) <- row.names(oregon.bird.dist)
kol <- gray (seq(0.8,0.2,length.out=length (table (group))))
map.groups (oregon.grid, group=group, col=kol)
lines (oregon.border)
# distribution of January temperatures
cuts <- quantile (oregon.env.vars[["jan.temp"]], probs=seq(0,1,1/5))
group <- cut (oregon.env.vars[["jan.temp"]], cuts, labels=FALSE,
include.lowest=TRUE)
names(group) <- row.names(oregon.env.vars)
kol <- gray (seq(0.8,0.2,length.out=length (table (group))))
map.groups (oregon.grid, group=group, col=kol)
lines (oregon.border)
# January temperatures using point symbols rather than polygons
map.groups (oregon.env.vars, group, col=kol, pch=19)
lines (oregon.border)