Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/00_S3_Definitions.R
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 choropleth function with the right arguments.
1 2 3  | 
x | 
 Object gadm_sf or 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 | 
 Vector of breaks values or a Sring name of a function from classIntervals (one of "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", or "jenks")  | 
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 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".  | 
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.  | 
subtitle | 
 String - subtitle of the plot. Default is NULL.  | 
caption | 
 String - caaption of the plot. Default is NULL.  | 
Since this relase, it's no longer necessary to rename the field of your dataset that is joined with the right field of the map. Just write adm.join="data_field_to_link".
Object ggplot2
—-
Jean Pierre Decorps <jp.decorps@epiconcept.fr>
—-
classIntervals
1 2 3 4 5 6 7 8 9 10 11 12 13  | library(GADMTools)
data("Corsica")
Cantons <- listNames(Corsica, 4)
pop <- floor(runif(length(Cantons), min=15200, max=23500))
DAT <- data.frame(Cantons, pop)
choropleth(Corsica, DAT,
           adm.join = "Cantons",
           value = "pop",
           breaks = "sd",
           palette="Oranges",
           legend = "Population",
           title="Population Cantons de Corse")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.