Typology

Description

This function represents a qualitative variable through a map. Polygons are filled in relation to the variable modalities.

Usage

1
2
3
4
5
6
mapChoroTypo(shpFile, shpId, df, dfId, var, 
             posLeg = "bottomleft", palCol = "Paired", NACol = "grey", 
             title = var, legend = var, author = "author", sources = "sources", 
             scalebar = FALSE, scalebarSize, scalebarText, 
             northArrow = FALSE, northArrowSize, 
             width = NULL, height = NULL, txtCex = NULL)

Arguments

shpFile

Path to a polygon shapefile.

shpId

Unique identifier of the shapefile. It must correspond to dfId.

df

Data frame that contains the variable to be mapped.

dfId

Unique identifier of the data frame. It must correspond to shpId.

var

Name of the qualitative variable to be mapped.

posLeg

Position of the legend (top, bottom, left, right, center, topleft, topright, bottomleft or bottomright).

palCol

Color palette, provided through RColorBrewer, to be used in the map. Use display.brewer.all() to see the available color ramps. For a more detailed overview : RColorBrewer.

NACol

Color used to draw units with no data (NA).

title

Title of the map.

legend

Title of the legend.

author

Two lines (author and sources) at the bottom of the map are available to display additional information. It is recommended to display the name of the author and the sources of the data and the base map.

sources

Two lines (author and sources) at the bottom of the map are available to display additional information. It is recommended to display the name of the author and the sources of the data and the base map.

scalebar

FALSE (default): don't draw a scale bar.
TRUE : draws a scale bar. The choice of the scale bar location is interactive.

scalebarSize

Size of the scale bar in map units.

scalebarText

Text of the scale bar.

northArrow

FALSE (default) : don't draw a North arrow.
TRUE : draws a North arrow. The choice of the North arrow location is interactive.

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.

Details

Only the five first arguments are compulsory.

Value

A typology map is displayed in the graphic window.
You can export the map in raster or vector format (pdf).

Author(s)

Timothee Giraud - UMS RIATE (CNRS)

See Also

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

Examples

1
2
3
4
5
6
7
8
library(rCarto)
data(mtq)
# minimal example
mtq[c(1,12,18,23,33,8,24),"beach"] <- "No access to the beach"
mtq[c(2,4,5,6,9,13,17,20,21,25,26,29,31,34,11,27,7,19),"beach"] <- "Caribbean Sea"
mtq[c(14,15,16,22,28,30,32,10,3),"beach"] <- "Atlantic Ocean"
mapChoroTypo(shpFile=file.path(path.package("rCarto"), "shapes/COMMUNE"),
              shpId="INSEE_COM",df=mtq,dfId="ID",var="beach")