colbar: A function to plot US map and add colors to each state based...

Description Usage Arguments Examples

View source: R/colbar.r

Description

This function used a stored US state and county GIS data to plot color maps to each state and county; the US map is projected to Albers

Usage

1
2
3
4
colbar(geoobj = us.states, values = runif(nrow(us.states) + 1, 0, 100),
  type = "rgb", ltitle = "Density", unit = "/mile", main = "Population",
  scheme = c("purple4", "blue4", "blue1", "green3", "yellowgreen", "yellow2",
  "sandybrown", "red", "darkred"))

Arguments

geoobj

A geo-object,

values

assigned values for each state to create color gradient,

type

seven types to pick from c("rgb","topo","heat", "rain","cm","ter"(rain), "gray")

ltitle

legend title

unit

unit for legend

scheme

color scheme for rgb.palette, only used for rbg.palette

Examples

1
2
3
4
colbar(geoobj=us.states, values= runif(nrow(us.states)+1, 0,100), # 1:51, #
type = "rgb.col", ltitle ="Density",
unit ="/mile", main ="Population",
scheme = c("purple4", "blue4","blue1","green3", "yellowgreen","yellow2","sandybrown","red","darkred") )

kevinlzheng/statemaps documentation built on May 20, 2019, 1:56 p.m.