geom_treemap() is used with a
aesthetic to subgroup treemap tiles,
be used to draw a border around each subgroup at the appropriate level.
geom_treemap_subgroup_border(mapping = NULL, data = NULL, stat = "identity", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, fixed = NULL, layout = "squarified", start = "bottomleft", level = "subgroup", ...) geom_treemap_subgroup2_border(...) geom_treemap_subgroup3_border(...)
|mapping, data, stat, position, na.rm, show.legend, inherit.aes, ...||
geom arguments as for
The layout algorithm, one of either 'squarified' (the default), 'scol', 'srow' or 'fixed'. See Details for full details on the different layout algorithms.
The corner in which to start placing the tiles. One of 'bottomleft' (the default), 'topleft', 'topright' or 'bottomright'.
One of 'subgroup', 'subgroup2' or 'subgroup3', giving the
subgrouping level for which to draw borders. It is recommended to use the
geom_treemap_subgroup_border() geoms require
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
followed by a
geom_treemap_subgroup2_border() layer, the second layer will
be drawn on top of the first and may hide it.
layout argument is used to set the treemap layout algorithm. All
'treemapify' geoms added to a plot should have the same value for
start, or they will not share a common layout (see
details on the layout algorithms).
subgroup, subgroup2 or subgroup3 (required)
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()