v_treemap | R Documentation |
Create a Treemap Chart
v_treemap(
vc,
mapping = NULL,
data = NULL,
name = NULL,
drill = TRUE,
...,
serie_id = NULL,
data_id = NULL
)
vc |
A chart initialized with |
mapping |
Default list of aesthetic mappings to use for chart. |
data |
Default dataset to use for chart. If not already
a |
name |
Name for the serie, only used for single serie (no |
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 |
A vchart()
htmlwidget
object.
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")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.