areamap: Area map function

Description Usage Arguments Details Examples

View source: R/areamap.R

Description

Creates a choropleth map for areal data using ggplot2.

Usage

1
2
areamap(shapefile = shapefile, adata = adata,
maptitle = "Map Title", guidetitle = "Guide Title")

Arguments

shapefile

A shapefile of the study region.

adata

A vector with the areal data.

maptitle

A title for the map.

guidetitle

A title for the map guide.

border

Logical. If FALSE, set the borders between the polygons transparent.

Details

This function is made to work like sp's spplot function. It creates a map for areal data but instead uses ggplot2 to do it.

The function receives a shapefile from the study region and a vector containing the areal data. The data in the vector must be ordered with the same order of the polygons of the shapefile and have the same length as the shapefile's polygons.

This function generates only a visualization of the spatial data. Further analysis of the spatial data can be made with the lmoranmap function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Loading the example data and the included shapefile

dengue.data = dengue
rio = rioshapefile

# The example data contains dengue counts between 2009 and 2013 for
# the Rio de Janeiro State. To create the map for one of these years
# we just need to use the areamap function.

dengue2010map = areamap(shapefile = rio, adata = dengue.data$`2010`,
maptitle = "Dengue counts for Rio de Janeiro in 2010",
guidetitle = "Frequency")

qspatialR/qspatial documentation built on April 30, 2020, 6:55 a.m.