Area-proportional nested rectangles, laid out with the squarified algorithm (Bruls, Huizing & van Wijk 2000) so tiles stay close to square and stay comparable by area.

geom_treemap(
  mapping = NULL,
  data = NULL,
  alpha = NULL,
  label = TRUE,
  label_size = NULL
)

Arguments

mapping, data

Standard layer overrides. Requires size (the area value) and label (the tile name); map color to shade by category.

alpha

Tile opacity.

label

Draw tile labels where they fit.

label_size

Label size in px.

Value

A Layer to add with +.

Examples

d <- data.frame(
  region = c("North", "South", "East", "West", "Central"),
  revenue = c(52, 38, 27, 19, 11)
)
ggnext(d, aes(size = revenue, label = region, color = region)) +
  geom_treemap() +
  theme_void()
#> <ggnext plot>
#>   data:  5 x 2
#>   aes:   size = revenue, label = region, color = region
#>   layers: 1 
#>   coord: cartesian
#>   mode:  static