Description Usage Arguments Details Value Author(s) See Also Examples
This function represents a numeric variable through a choropleth map.
1 2 3 4 5 6 7 8 9 10 | mapChoropleth(shpFile, shpId, df, dfId, var,
nclass = 6, style = "quantile",
fixBrks = FALSE, listBrks = NULL, diverg = FALSE, divergBrk = 0,
lgdRnd = 2, posLeg = "bottomleft",
palCol = "Greens", palColPos = "Reds", palColNeg = "Blues",
NACol = "grey",
title = var, legend = var, author = "author", sources = "sources",
scalebar = FALSE, scalebarSize, scalebarText,
northArrow = FALSE, northArrowSize,
width = NULL, height = NULL, txtCex = NULL)
|
shpFile |
Path to a polygon shapefile. |
shpId |
Unique identifier of the shapefile. It must correspond to |
df |
Data frame that contains the variable to be mapped. |
dfId |
Unique identifier of the data frame. It must correspond to |
var |
Name of the numeric variable to be mapped. |
nclass |
Number of classes to be represented. |
style |
Method used to provide the class intervals.
See |
fixBrks |
|
listBrks |
Vector of values used as breaks for the class intervals when |
diverg |
|
divergBrk |
Value used to define the break in the color palette if |
lgdRnd |
Rounding of the class intervals presented in the legend. |
posLeg |
Position of the legend (top, bottom, left, right, center, topleft, topright, bottomleft or bottomright). |
palCol |
Color palette, provided through |
palColPos |
Palette used for values superior to |
palColNeg |
Palette used for values inferior to |
NACol |
Color used to draw units with no data ( |
title |
Title of the map. |
legend |
Title of the legend. |
author |
Two lines ( |
sources |
Two lines ( |
scalebar |
|
scalebarSize |
Size of the scale bar in map units. |
scalebarText |
Text of the scale bar. |
northArrow |
|
northArrowSize |
Size of the North arrow in map units. |
width |
Width of the map in cm. |
height |
Height of the map in cm. |
txtCex |
Size of the texts. |
Only the five first arguments are compulsory.
A choropleth map is displayed in the graphic window.
You can export the map in raster or vector format (pdf).
Timothee Giraud - UMS RIATE (CNRS)
rCarto-package | rCarto package |
mapCircles | proportional circles |
mapCirclesChoro | proportional circles colored by a discretized quantitative variable |
mapCirclesTypo | proportional circles colored by the modalities of a qualitative variable |
mapChoropleth | choropleth |
mapChoroTypo | typology |
mtq | data |
commune | shapefile |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(rCarto)
data(mtq)
# minimal example
mtq$POPVAR <- (mtq$P09_POP-mtq$P99_POP) / mtq$P99_POP
mapChoropleth(shpFile=file.path(path.package("rCarto"), "shapes/COMMUNE"),
shpId="INSEE_COM",df=mtq,dfId="ID",var="POPVAR")
# detailed example
mtq$POPVAR[3] <- NA
mapChoropleth(shpFile=file.path(path.package("rCarto"), "shapes/COMMUNE"),
shpId="INSEE_COM",df=mtq,dfId="ID",var="POPVAR",
nclass=6,style="quantile",
diverg=TRUE,divergBrk=0,
lgdRnd=2,posLeg="bottomleft",
palColPos="Greens",palColNeg="Blues",NACol="grey",
title="Population growth in Martinique",
legend="Population growth\nrate between\n1999 and 2009",
author=Sys.getenv("USERNAME"),
sources="data : INSEE,2009; basemap : IGN, 2012")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.