map.groups: Map Groups of Observations

map.groupsR 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 "x", and "y" for each observation (see details).

group

vector of integer class numbers corresponding to pts (see details), and indexing colors in col.

pch

symbol number from par("pch") if < 100, otherwise parameter n for ngon.

size

size in cex units of point symbol.

col

vector of fill colors from hsv, rgb, etc, or if NULL, then use rainbow.

border

vector of border colors from hsv, rgb, etc, or if NULL, then use rainbow.

new

if TRUE, call plot.new.

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)

maptree documentation built on April 6, 2022, 5:09 p.m.

Related to map.groups in maptree...