View source: R/geom_treemap_text.R
geom_treemap_text | R Documentation |
geom_treemap_text()
can be used to add a text label to each tile in a
treemap created with geom_treemap()
.
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 = FALSE,
reflow = FALSE,
fixed = NULL,
layout = "squarified",
start = "bottomleft",
...
)
mapping, data, stat, position, na.rm, show.legend, inherit.aes, ... |
Standard
geom arguments as for |
padding.x, padding.y |
|
place |
Where inside the box to place the text. Default is 'bottom'; other options are 'topleft', 'top', 'topright', etc. |
min.size |
Minimum font size, in points. If provided, text that would need to be shrunk below this size to fit the box will not be drawn. Defaults to 4 pt. |
grow |
If |
reflow |
If |
fixed |
Deprecated. Use |
layout |
The layout algorithm, one of either 'squarified' (the default), 'scol', 'srow' or 'fixed'. See Details for full details on the different layout algorithms. |
start |
The corner in which to start placing the tiles. One of 'bottomleft' (the default), 'topleft', 'topright' or 'bottomright'. |
geom_treemap_text()
requires area
and label
aesthetics. Several other
standard 'ggplot2' aesthetics are supported (see Aesthetics).
geom_treemap_text()
uses the 'ggfittext' package to fit text to tiles. All
text drawing options available in ggfittext::geom_fit_text()
(growing,
reflowing, etc.) are also available here. For full details on how these
options work, see the documentation for ggfittext::geom_fit_text()
.
The layout
argument is used to set the treemap layout algorithm. All
'treemapify' geoms added to a plot should have the same value for layout
and start
, or they will not share a common layout (see geom_treemap()
for details on the layout algorithms).
area (required)
label (required)
subgroup, subgroup2 or subgroup3
colour
size
alpha
family
fontface
angle
geom_treemap()
ggplot2::ggplot(G20, ggplot2::aes(area = gdp_mil_usd,
fill = econ_classification,
label = country)) +
geom_treemap() +
geom_treemap_text()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.