assign.poly.color {climdiv}R Documentation

Assign Colors for Plotting Polygons in a Polygon List

Description

assigns a color to all polygons with the same string in their region.id attribute

Usage

assign.poly.color(name, color, plist)

Arguments

name vector of character strings to match to polygon region id attribute
color vector of colors
plist polylist object to be plotted

Details

This function generates a list of colors corresponding to each polygon in a polylist object by matching the string you supply to elements of the region.id attributes of a polylist. Plot (plot.polylist) cannot plot subsets of the polygons in a polylist. This function assigns color = NA for polygons you do not wish to plot. It also allows you to assign a single color easily to all the component polygons of a single entity. Sets fill colors of polygons not selected to NA, so they are not filled.

Value

list of colors the same length as the number of polygons in a polylist

Author(s)

Anthony L. Westerling

References

http://tenaya.ucsd.edu/~westerli/westerling.html

Examples


#plot the western climate divisions colored by state
data(col.coolhot20)
data(climdiv.poly)
quartz()
plot(climdiv.poly, border=FALSE, col=assign.poly.color(c("CA", "NV", "AZ", "NM", "CO", "UT","WY","MT","ID","WA","OR"), col.coolhot20[5:15],climdiv.poly), xlim=c(-125,-102))

[Package climdiv version 0.3 Index]