map.key: Draw Key to accompany Map of Groups

map.keyR Documentation

Draw Key to accompany Map of Groups

Description

Draws legends for maps of groups of observations.

Usage

  map.key (x, y, labels=NULL, cex=par("cex"), pch=par("pch"),
      size=2.5*cex, col=NULL, head="", sep=0.25*cex, new=FALSE)

Arguments

x, y

coordinates of lower left position of key in proportional units (0-1) of plot.

labels

vector of labels for classes, or if NULL, then integers 1:length(col), or 1.

size

size in cex units of shaded key symbol.

pch

symbol number for par if < 100, otherwise parameter n for ngon.

cex

pointsize of text, par parameter.

head

text heading for key.

sep

separation in cex units between adjacent symbols in key. If sep=0, assume a continuous scale, use square symbols, and put labels at breaks between squares.

col

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

new

if TRUE, call plot.

Details

Uses points or ngon, depending on value of pch, to draw shaded polygon symbols for key.

Value

The vector of colors supplied or generated.

Author(s)

Denis White

See Also

ngon, map.groups

Examples

  data (oregon.env.vars)

  # key for examples in help(map.groups)
  # range map for American Avocet
  kol <- gray (seq(0.8,0.2,length.out=2))
  map.key (0.2, 0.2, labels=c("absent","present"), pch=106, 
    col=kol, head="key", new=TRUE)
  # distribution of January temperatures
  cuts <- quantile (oregon.env.vars[["jan.temp"]], probs=seq(0,1,1/5))
  kol <- gray (seq(0.8,0.2,length.out=5))
  map.key (0.2, 0.2, labels=as.character(round(cuts,0)), 
    col=kol, sep=0, head="key", new=TRUE)

  # key for example in help file for group.tree
  map.key (0.2, 0.2, labels=as.character(seq(6)), 
    pch=19, head="node", new=TRUE)

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

Related to map.key in maptree...