Learn R Programming

SpatialEpi (version 1.2.8)

plotmap: Plot Levels of a Variable in a Colour-Coded Map

Description

Plot levels of a variable in a colour-coded map.

Usage

plotmap(
  values,
  map,
  log = FALSE,
  nclr = 7,
  include.legend = TRUE,
  lwd = 0.5,
  round = 3,
  brks = NULL,
  legend = NULL,
  location = "topright",
  rev = FALSE
)

Value

A map colour-coded to indicate the different levels of values.

Arguments

values

variable to plot

map

an object of class SpatialPolygons (See SpatialPolygons-class)

log

boolean of whether to plot values on log scale

nclr

number of colour-levels to use

include.legend

boolean of whether to include legend

lwd

line width of borders of areas

round

number of digits to round to in legend

brks

if desired, pre-specified breaks for legend

legend

if desired, a pre-specified legend

location

location of legend

rev

boolean of whether to reverse colour scheme (darker colours for smaller values)

Author

Albert Y. Kim

Examples

Run this code
## Load data
data(scotland)
map <- scotland$spatial.polygon
y <- scotland$data$cases
E <- scotland$data$expected
SMR <- y/E
## Plot SMR
plotmap(SMR, map, nclr=9, location="topleft")

Run the code above in your browser using DataLab