This will draw a text label for each tile in a treemap created by
geom_treemap
. In addition to the required 'label' aesthetic, it
requires an 'area' aesthetic as used in geom_treemap
; if this is
mapped to a different column, or geom_treemap
and
geom_treemap_text
are passed different data, the text labels probably
won't line up with the tiles.
geom_treemap_text
uses geom_fit_text
from the ggfittext
package to fit text to the tile. All text drawing options available in
ggfittext
(growing, reflowing, etc.) are also available here. For full
details see the documentation for ggfittext::geom_fit_text
.
geom_treemap_text(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = FALSE,
inherit.aes = TRUE, padding.x = grid::unit(1, "mm"),
padding.y = grid::unit(1, "mm"), place = "topleft", min.size = 4,
grow = F, reflow = F, fixed = F, ...)
Standard
geom arguments as for geom_rect
.
Unit object, giving horizontal or vertical padding between text and edge of tile. Defaults to 1 mm.
Where should the text be drawn within the tile? One of 'topleft', 'top', 'topright' etc. Defaults to 'topleft'.
Number, in points. Text that would need to be drawn smaller than this size to fit in the tile will be hidden. Defaults to 4 pt.
Logical; should text grow to fill the entire tile? Defaults to false.
Logical; should text should be reflowed (wrapped) to better fit the bounding box? Defaults to false.
Logical, indicating whether the fixed layout algorithm
should be used. Defaults to false. See geom_treemap
for full details.
area (required)
label (required)
colour
size
alpha
family
fontface
angle
geom_treemap, geom_fit_text