gadm_dotDensity: Multivariate Dot-Density maps

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

Description

A dot-density map is one way to map aggregated spatial data without some of the distortions inherent in choropleths.

Usage

1
2
3
4
dotDensity(map, data, adm.join  = NULL, values = NULL,
                            cases.by.dots = 100, dot.size = .25, labels = NULL,
                            palette   = NULL, title = NULL, subtitle  = NULL,
                            caption   = NULL)

Arguments

map

Object gadm_sf

data

data.frame - data to plot

values

String - the names of the columns in the data.frame we want to plot. (eg: number of cases)

cases.by.dots

integer of breaks values

dot.size

numericr - size of dots. Default = 0.25.

adm.join

String - the name in your dataset joined with the field NAME_X of the map, where X is the level of the administrative boundaries. For instance if the level is about 'Districts' of a country, and your dataset has a field named "Study_Location" containing a list of districts, just do adm.join = "Study_Location".

labels

String vector labels for the legend. Default NULL. If NULL values are used as labels

palette

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

title

String - title of the plot. Default is NULL

subtitle

String - subtitle of the plot. Default is NULL.

caption

String - caption of the plot. Default is NULL.

Details

—-

Value

Object ggplot2

Note

dotDensity only works with maps loaded with gadm_sf_loadCountries

Author(s)

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

References

https://en.wikipedia.org/wiki/Dot_distribution_map

See Also

classIntervals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(GADMTools)
data("Corsica")

# Creates test data.frame (fake data) --------------------------------------
# --------------------------------------------------------------------------
VAR_1 <- as.integer(runif(n = 43, min = 800, max = 15800))
VAR_2 <- as.integer(runif(n = 43, min = 1000, max = 15800))
VAR_3 <- as.integer(runif(n = 43, min = 1500, max = 15800))
Cantons <- listNames(Corsica, 4)
DF <- data.frame(Cantons, VAR_1, VAR_2, VAR_3, stringsAsFactors = FALSE)

dotDensity(Corsica,
                DF,
                adm.join="Cantons",
                values = c("VAR_1", "VAR_2", "VAR_3"),
                labels = c("H1N1", "H1N2", "H2N2"),
                palette = c("#ffff00", "#ffaa00", "#FF3200"))

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