geom_treemap_subgroup_border {treemapify}R Documentation

'ggplot2' geoms to draw a border around a subgroup of treemap tiles.

Description

When 'geom_treemap' is used with a 'subgroup', 'subgroup2' or 'subgroup3' aesthetic to subgroup treemap tiles, 'geom_treemap_subgroup_border', 'geom_treemap_subgroup2_border' or 'geom_treemap_subgroup3_border' can be used to draw a border around each subgroup at the appropriate level.

Usage

geom_treemap_subgroup_border(mapping = NULL, data = NULL,
  stat = "identity", position = "identity", na.rm = FALSE,
  show.legend = NA, inherit.aes = TRUE, fixed = F, level = "subgroup",
  ...)

geom_treemap_subgroup2_border(...)

geom_treemap_subgroup3_border(...)

Arguments

mapping, data, stat, position, na.rm, show.legend, inherit.aes, ...

Standard geom arguments as for 'ggplot2::geom_rect'.

fixed

If ‘TRUE', the alternative ’fixed' tile layout algorithm will be used.

level

One of 'subgroup', 'subgroup2' or 'subgroup3', giving the subgrouping level for which to draw borders. It is recommended to use the aliases 'geom_treemap_subgroup2_border' and 'geom_treemap_subgroup3_border' instead of this argument.

Details

'geom_treemap_subgroup_border' geoms require 'area' and 'subgroup' (or ‘subgroup2, 'subgroup3') aesthetics. Several other standard ’ggplot2' aesthetics are supported (see Aesthetics).

Note that 'ggplot2' draws plot layers in the order they are added to the plot. This means that if you add a 'geom_treemap_subgroup_border' layer followed by a 'geom_treemap_subgroup2_border' layer, the second layer will be drawn on top of the first and may hide it.

The 'fixed' argument is used to set the treemap layout algorithm. All 'treemapify' geoms added to a plot should have the same value for 'fixed', or they will not share a common layout (see 'geom_treemap' for details on the layout algorithms).

Aesthetics

See Also

geom_treemap, geom_treemap_subgroup_text

Examples


ggplot2::ggplot(G20, ggplot2::aes(area = gdp_mil_usd, fill = hdi,
                                  subgroup = hemisphere, subgroup2 = region)) +
  geom_treemap() +
  geom_treemap_subgroup2_border(colour = "white") +
  geom_treemap_subgroup_border()


[Package treemapify version 2.5.0 Index]