fast.choropleth: Draw a choropleth on selected regions with lattice.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/47_fast.choropleth.R

Description

Drawing a choropleth (colored regions based on data values) with GADMTools is straightforward. You just have to select your shape(s) file(s) with gadm_loadcountries, load your data from a csv file for example, and call the fast.choropleth function with the right arguments. fast.choropleth does not use ggplot2 but lattice, so it is very fast.

Usage

1
2
3
fast.choropleth (x, data, value=NULL, breaks = NULL, steps = 5,
  adm.join=NULL, legend = NULL, labels = NULL, palette=NULL,
  title="")

Arguments

x

Object gadm_sp

data

data.frame - data to plot

value

String - the name of the column in the data.frame we want to plot (eg: an incidence in epidemiology studies)

breaks
steps

Integer - number of breaks. Default = 5. If breaks is NOT NULL this value is used internally with cut().

adm.join

String - the name in GADM spdf dataset which will be joined with a column of the data.

legend

String - legend title. Default NULL.

labels

String vector labels for the legend. Default NULL

palette

String - An RColorBrewer palette name or a String vector vector of colors. Default NULL.

title

String - Title of the plot. Default is an empty string.

Details

—-

Value

Object a lattice plot of class "trellis"

Note

—-

Author(s)

Jean Pierre Decorps <jp.decorps@epiconcept.fr>

References

—-

See Also

classIntervals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# MAP <- gadm_loadCountries("BEL", level = 3, simplify=0.01)
# DAT = read.csv2("BE_clamydia_incidence.csv")

# DAT <- rename(DAT, NAME_3 = district)

# fast.choropleth(MAP, DAT,
#                adm.join = "NAME_3",
#                value = "rate03",
#                steps = 4,
#                breaks = "jenks",
#                palette="Greens",
#                legend = "Incidence",
#                title="Chlamydia incidence by Belgian district (2003)")

GADMTools documentation built on Aug. 5, 2021, 1:06 a.m.