Package 'tabularmaps'

Title: Create Tile-Grid Geographical Maps
Description: The 'tabularmap' is one of the visualization methods for efficiently displaying data consisting of multiple elements by tiling them. When dealing with geospatial, it corrects for differences in visibility between areas.
Authors: Shinya Uryu [aut, cre]
Maintainer: Shinya Uryu <[email protected]>
License: CC BY-SA 4.0
Version: 0.1.0.9000
Built: 2024-09-24 02:58:44 UTC
Source: https://github.com/uribo/tabularmaps

Help Index


Country list

Description

A data frame include ISO-3166 codes.

Usage

iso3166

Format

A data frame with 250 rows 8 variables:

  • country_name:

  • continent:

  • region:

  • iso2c:

  • iso3c:

  • iso3n: 3 digits number (as character)

  • x: Coordinates for displaying as tabularmap

  • y: Coordinates for displaying as tabularmap


Japan 7x7 grid dataset

Description

Prefectures dataset.

Usage

jpn77

Format

A data frame with 47 rows 8 variables:

  • jis_code: jis code

  • prefecture: prefecture names

  • region: region

  • major_island:

  • prefecture_kanji:

  • region_kanji:

  • x: Coordinates for displaying as tabularmap

  • y: Coordinates for displaying as tabularmap


Coloring the tabularmaps by region in Japan

Description

Custom ggplot2 scale for tabulamap.

Usage

scale_fill_jpregion(lang, ...)

Arguments

lang

Select whether the region variable is Japanese (jp) or English (en).

...

all other arguments passed on to ggplot2::scale_fill_manual()


Create Tile-Grid

Description

A ggplot2-based tabularmap that places a coordinated dataset in a rectangle.

Usage

tabularmap(
  data,
  x,
  y,
  group,
  fill = NULL,
  label = NULL,
  ...,
  .expand_size = 10,
  .radius_size = 2
)

Arguments

data

data.frame. Contain x, y, group and label variables used as coordinates.

x, y

A column containing the numbers to line up the items.

group

Group variable.

fill

Fill colour variable.

label

Label variable.

...

All other arguments passed on to ggplot2::geom_text() include label family.

.expand_size

The value specified in the expand argument of ggforce::geom_shape(). The unit is in mm.

.radius_size

The value specified in the radius argument of ggforce::geom_shape(). The unit is in pt.

Examples

library(ggplot2)
tabularmap(jpn77, x, y, group = jis_code, label = prefecture, size = 3)
tabularmap(jpn77, x, y, group = jis_code, fill = region, label = prefecture, size = 3) +
  theme_tabularmap() +
  scale_fill_jpregion(lang = "en")
tabularmap(data.frame(
             id = letters[seq.int(9)],
             x = rep(c(1,2,3), each = 3),
             y = rep(c(1,2,3), times = 3),
             fill = seq.int(9),
             label = letters[seq.int(9)]),
  x, y,
  group = id,
  fill = fill,
  label = label,
  .expand_size = 20, .radius_size = 10)
tabularmap(iso3166, x, y, group = iso2c,
           fill = continent,
           label = iso2c,
           .expand_size = 5) +
  theme_tabularmap() +
  guides(fill = FALSE)

Tabularmap theme

Description

Custom ggplot2 theme for tabulamap.

Usage

theme_tabularmap(...)

Arguments

...

all other arguments passed on to ggplot2::theme_minimal()


Special wards of Tokyo

Description

Tokyo 23 wards dataset.

Usage

tky23

Format

A data frame with 23 rows 5 variables:

  • no: Identifical number

  • ward: Name

  • ward_kanji: Names in Kanji

  • x, y: Coordinates for displaying as tabularmap