Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mapvariable

Plot Levels of a Variable in a Colour-Coded Map


Description

Plot levels of a variable in a colour-coded map along with a legend.

Usage

mapvariable(y, spatial.polygon, ncut=1000, nlevels=10, lower=NULL, upper=NULL, 
main=NULL, xlab=NULL, ylab=NULL)

Arguments

y

variable to plot

spatial.polygon

an object of class SpatialPolygons (See SpatialPolygons-class)

ncut

number of cuts in colour levels to plot

nlevels

number of levels to include in legend

lower

lower bound of levels

upper

upper bound of levels

main

an overall title for the plot

xlab

a title for the x axis

ylab

a title for the y axis

Value

A map colour-coded to indicate the different levels of y

Author(s)

Jon Wakefield, Nicky Best, Sebastien Haneuse, and Albert Y. Kim

References

Bivand, R. S., Pebesma E. J., and Gomez-Rubio V. (2008) Applied Spatial Data Analysis with R. Springer Series in Statistics.

E. J. Pebesma and R. S. Bivand. (2005) Classes and methods for spatial data in R. R News, 5, 9–13.

Examples

data(scotland)
map <- scotland$spatial.polygon
y <- scotland$data$cases
E <- scotland$data$expected
SMR <- y/E
mapvariable(SMR,map,main="Scotland",xlab="Eastings (km)",ylab="Northings (km)")

SpatialEpi

Methods and Data for Spatial Epidemiology

v1.2.3
GPL-2
Authors
Cici Chen [ctb], Albert Y. Kim [aut, cre], Michelle Ross [ctb], Jon Wakefield [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.