tabularmap {tabularmaps}R Documentation

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)

[Package tabularmaps version 0.1.0 Index]