mapCircles: Proportional Circles

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

Description

This function represents a variable through a proportional circles map. The areas of the circles are proportional to values of a numeric variable.

Usage

1
2
3
4
5
6
7
8
9
mapCircles(shpFile, shpId, df, dfId, var,
          fixedNorm = FALSE, shareOfCircles = 0.02, 
          radiusMax = 0.5, valueMax = max(df[, var], na.rm = TRUE), 
          lgdRnd = 0, posLeg = "bottomleft", 
          circleCol = "#FD8D3C", baseCol = "#FFEDA0", 
          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 positive numeric variable to be mapped.

fixedNorm

FALSE (default) : the sum of the surfaces occupied by circles is proportional to the size of the map and is declared by the shareOfCircles argument, radiusMax and valueMax are not used.
TRUE : the size of the largest circle is defined by a radius size (radiusMax) and a fixed variable value (valueMax), the shareOfCircles argument is not used.

shareOfCircles

Share of the surface of the map occupied by circles (0.02 is 2%).

radiusMax

Size (in cm) of the radius of the biggest circle.

valueMax

Value used to normalize the size of the largest circle (in variable units).

lgdRnd

Rounding of the values of the variable presented in the legend.

posLeg

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

circleCol

Color of the circles.

baseCol

Color of the base map.

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

The circles are centered on the centroids of the polygons.
Only the five first arguments are compulsory.

Value

A proportionnal circle 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
 9
10
11
12
13
14
15
library(rCarto)
data(mtq)
# minimal example
mapCircles(shpFile=file.path(path.package("rCarto"), "shapes/COMMUNE"),
           shpId="INSEE_COM",df=mtq,dfId="ID",var="P09_POP", )

# detailed example
mapCircles(shpFile=file.path(path.package("rCarto"), "shapes/COMMUNE"),
           shpId="INSEE_COM",df=mtq,dfId="ID",var="P09_POP",
           shareOfCircle=0.1,
           lgdRnd=0,circleCol="Red",
           title="Population distribution in Martinique",
           legend="Total resident\npopulation in 2009",
           author=Sys.getenv("USERNAME"),
           sources="data : INSEE,2009; basemap : IGN, 2012")

Example output

Loading required package: RColorBrewer
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: FALSE
 	Note: when rgeos is not available, polygon geometry 	computations in maptools depend on gpclib,
 	which has a restricted licence. It is disabled by default;
 	to enable gpclib, type gpclibPermit()
Loading required package: classInt
Warning messages:
1: readShapeSpatial is deprecated; use rgdal::readOGR or sf::st_read 
2: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read 
Warning messages:
1: readShapeSpatial is deprecated; use rgdal::readOGR or sf::st_read 
2: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read 

rCarto documentation built on May 2, 2019, 8:20 a.m.