tabularmap: Create Tile-Grid

Description Usage Arguments Examples

View source: R/tabularmap.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)

tabularmaps documentation built on Aug. 4, 2020, 9:06 a.m.