Create a Treemap Chart
v_treemap.RdCreate a Treemap Chart
Usage
v_treemap(
vc,
mapping = NULL,
data = NULL,
name = NULL,
drill = TRUE,
...,
serie_id = NULL,
data_id = NULL
)Arguments
- vc
A chart initialized with
vchart().- mapping
Default list of aesthetic mappings to use for chart.
- data
Default dataset to use for chart. If not already a
data.frame, it will be coerced to withas.data.frame.- name
Name for the serie, only used for single serie (no
color/fillaesthetic supplied).- drill
Drill-down function switch.
- ...
Additional parameters for the serie.
- data_id, serie_id
ID for the data/serie, can be used to further customize the chart with
v_specs().
Value
A vchart() htmlwidget object.
Examples
library(vchartr)
# Basic Treemap Chart
vchart(countries_gdp) %>%
v_treemap(aes(lvl1 = REGION_UN, lvl2 = ADMIN, value = GDP_MD))
# With labels
vchart(countries_gdp) %>%
v_treemap(
aes(lvl1 = REGION_UN, lvl2 = ADMIN, value = GDP_MD),
label = list(visible = TRUE)
)
# Show all levels
vchart(countries_gdp) %>%
v_treemap(
aes(lvl1 = REGION_UN, lvl2 = ADMIN, value = GDP_MD),
label = list(visible = TRUE),
nonLeaf = list(visible = TRUE),
nonLeafLabel = list(visible = TRUE, position = "top")
)