JapanPrefMap {NipponMap}R Documentation

A simple choropleth map of Japan

Description

Draw a very simple choropleth map of Japan with prefecture boundaries

Usage

JapanPrefMap(col = NULL, inset = TRUE, ...)

Arguments

col

A character vector. RGB or named colors in order of JISCODE to fill a polygon of 47 prefectures.

inset

logical. if TRUE, Okinawa Prefecture is shown in a inset map. The default value is TRUE.

...

any other options passed to plot method of Simple features class.

Details

The function JapanPrefMap draws a simple choropleth map of Japan in prefecture level with or without inset of Okinawa Prefecture. This feature is most frequently desired by Japanese R users but has been difficult to draw with R functions, for example, map('japan') in mapdata package. What is important is that this function receives a color vector in order of JIS code of prefectures. Since most official statistics by prefecture is in order of the JIS code, users simply create a color sequence for a choropleth map without any rearranging the order. Users are now freed from a trouble in applying order or merge functions to their data set.

Population set was retrieved from 2010 Population Census of Japan.

Value

A matrix. The coordinates of a label point in each prefecture.

Note

For the sake of simple visualization, prefecture boundaries are lacking accuracy; assisted by Quantum GIS (http://www.qgis.org/), the author drew by hand the boundaries omitting minor islands. Therefore, users should not use the map for calculating area or measuring a distance.

Author(s)

Susumu Tanimura aruminat@gmail.com

See Also

cshp in cshapes package, japan in mapdata package.

Examples

JapanPrefMap()

if (requireNamespace("RColorBrewer", quietly = TRUE)) {
  cols <- rev(RColorBrewer::brewer.pal(8,"Set2"))
}else{
  cols <- sample(colours(), 47)
}
JapanPrefMap(col = cols, border = gray(.8), axes = TRUE)

if (requireNamespace("foreign", quietly = TRUE)) {
dat <- foreign::read.dbf(system.file("shapes/jpn.dbf", package="NipponMap"))
op <- par(bg = "skyblue")
p <- JapanPrefMap(col = "ivory")
col <- c("olivedrab4", "olivedrab1")
pop <- dat$population / 1e+7
symbols(p, circles = sqrt(pop / (2 * pi)), inches = FALSE,
    fg = col[1], bg = col[2], add = TRUE)
idx <- c(1e+6, 5e+6, 1e+7)
pos <- legend("bottomright", legend = format(idx, scientific = 10, big.mark = ","),
    title = "Population (2010)", bg = "white", x.intersp = 2, y.intersp = 1.5)
symbols(pos$text$x - 1, pos$text$y, circles = sqrt(idx / 1e+7 / (2 * pi)),
    inches = FALSE, fg = col[1], bg = col[2], add = TRUE)
par(op)
}

[Package NipponMap version 0.2 Index]