Title: | Japanese Map Data and Functions |
---|---|
Description: | Digital map data of Japan for choropleth mapping, including a circle cartogram. |
Authors: | Susumu Tanimura [aut, cre] |
Maintainer: | Susumu Tanimura <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2 |
Built: | 2025-02-23 05:47:35 UTC |
Source: | https://github.com/cran/NipponMap |
Digital map data of Japan for choropleth mapping, including a circle cartogram.
The DESCRIPTION file:
Package: | NipponMap |
Version: | 0.2 |
Date: | 2018-05-16 |
Title: | Japanese Map Data and Functions |
Authors@R: | c(person("Susumu", "Tanimura", role = c("aut", "cre"), email = "[email protected]")) |
Author: | Susumu Tanimura [aut, cre] |
Maintainer: | Susumu Tanimura <[email protected]> |
Imports: | sf, tibble |
Suggests: | RColorBrewer, foreign |
Enhances: | kokudosuuchi, estatapi, jpndistrict, jpmesh |
Description: | Digital map data of Japan for choropleth mapping, including a circle cartogram. |
License: | GPL (>= 2) |
NeedsCompilation: | no |
Type: | Package |
Packaged: | 2018-05-16 12:20:41 UTC; umusus |
Date/Publication: | 2018-05-16 12:30:20 UTC |
Config/pak/sysreqs: | libgdal-dev gdal-bin libgeos-dev libssl-dev libproj-dev libsqlite3-dev libudunits2-dev |
Repository: | https://stanimura.r-universe.dev |
RemoteUrl: | https://github.com/cran/NipponMap |
RemoteRef: | HEAD |
RemoteSha: | 5981259f1d5d588f225dfaf49490c01f7534f237 |
Index of help topics:
JapanPrefCartogram A simple circle cartogram of Japan JapanPrefMap A simple choropleth map of Japan NipponMap-package Japanese Map Data and Functions
The package provides digital map data and functions of Japan for very simple choropleth mapping in prefecture level. The cartographic function in Nippon package was moved to NipponMap package. If a user needs more complex digital map data or in municipal level, such data is available in other package (e.g., jpndistrict and divagis).
Susumu Tanimura [aut, cre]
Maintainer: Susumu Tanimura <[email protected]>
Draw a circle cartogram of Japan in the prefecture level
JapanPrefCartogram(col = NULL, axes = FALSE, xlab = "", ylab = "", xlim = NULL, ylim = NULL, main = NULL, ...)
JapanPrefCartogram(col = NULL, axes = FALSE, xlab = "", ylab = "", xlim = NULL, ylim = NULL, main = NULL, ...)
col |
A character vector. RGB or named colors in order of JISCODE to fill a polygon of 47 prefectures. |
axes |
logical. If TRUE, axes are drawn. The default value is FALSE. |
xlab |
A title for the x axis. The default value is NULL. |
ylab |
A title for the y axis. The default value is NULL. |
xlim |
The x-range to be displayed. The default value is NULL. |
ylim |
The y-range to be displayed. The default value is NULL. |
main |
An overall title for the plot |
... |
any other options passed to control circles. |
The function JapanPrefCartogram
draws a simple circle
cartogram of Japan in prefecture level. The size of circles represents
population in 2015 in each prefecture. Currently, the size is
fixed. Users can control only colors and some other graphic
parameters. The order of colors must match to the JIS-code order of
prefectures in Japan.
Population set was obtained from 2015 Population Census of Japan.
A data.frame. The coordinates of a label point in each prefecture.
The author would like to express the deepest appreciation to Prof. Luc Anselin, the developer of GeoDa, the output of which was used for calculation of the coordinates of this cartogram.
Susumu Tanimura [email protected]
JapanPrefCartogram() op <- palette(rainbow(47, end = 0.9)) xy <- JapanPrefCartogram(col = 1:47, fg = gray(.8)) lb <- character(47) lb[13] <- "Tokyo" text(xy, lb) palette(op)
JapanPrefCartogram() op <- palette(rainbow(47, end = 0.9)) xy <- JapanPrefCartogram(col = 1:47, fg = gray(.8)) lb <- character(47) lb[13] <- "Tokyo" text(xy, lb) palette(op)
Draw a very simple choropleth map of Japan with prefecture boundaries
JapanPrefMap(col = NULL, inset = TRUE, ...)
JapanPrefMap(col = NULL, inset = TRUE, ...)
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. |
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.
A matrix. The coordinates of a label point in each prefecture.
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.
Susumu Tanimura [email protected]
cshp
in cshapes package,
japan
in mapdata package.
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) }
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) }