Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

map.text

Draw a map with labeled regions


Description

Like map, but labels the regions.

Usage

map.text(database, regions = ".", exact = FALSE, labels, cex = 0.75,
add = FALSE, move = FALSE, ...)

Arguments

database

character string naming a geographical database, or a list of x, y, and names obtained from a previous call to map.

regions

character vector that names the polygons to draw.

exact

If 'TRUE', only exact matches with 'regions' are selected for drawing.

labels

character vector of labels, one for each region selected. Defaults to the names in the database.

cex

character expansion factor.

add

If FALSE, a map is drawn, then labels placed on top. If TRUE, labels are added to the existing map.

move

If TRUE, labels are moved so that they don't overlap. Requires the mining library (not in CRAN, contact tpminka@media.mit.edu).

...

Other arguments are the same as in map.

Value

If add = FALSE, a map is drawn by calling map. Then the label for each region is placed at the centroid of the region polygon.

The return value is a map object, as from map.

Author(s)

Tom Minka

Examples

map.text("world", "ira")    # iran and iraq
map.text("state", "penn")
map.text("county", "penn")  # Pennsylvania counties
map.text("county", "new jersey")  # New Jersey counties

maps

Draw Geographical Maps

v3.3.0
GPL-2
Authors
Original S code by Richard A. Becker and Allan R. Wilks. R version by Ray Brownrigg. Enhancements by Thomas P Minka and Alex Deckmyn.
Initial release
2018-04-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.