Learn R Programming

surveillance (version 1.8-3)

layout.labels: Layout Item for Feature Labels in spplot

Description

Generate an sp.layout item for use in spplot in order to draw labels at the coordinates of the spatial object.

Usage

layout.labels(obj, labels = TRUE)

Arguments

obj
an object inheriting from a Spatial class.
labels
specification of the labels:
  • aFALSEorNULLvalue omits labels (NULLis returned),
  • labels = TRUEusesrow.names(obj),
  • a character or numeric index for a column of

Value

  • an sp.layout item for spplot, which is a list. Its first element is "panel.text" and subsequent elements are arguments to that function based on the labels specification.

Examples

Run this code
data("measlesWeserEms")
(li <- layout.labels(measlesWeserEms@map, labels = list(font=2, labels="GEN")))

## example usage in spplot()
spplot(measlesWeserEms@map, zcol = "AREA", sp.layout = list(li),
       col.regions = rev(heat.colors(100)))

Run the code above in your browser using DataLab