SpatialEpi (version 1.2.3)

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

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

Run this code
# NOT RUN {
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)")
# }

Run the code above in your browser using DataCamp Workspace