e_treemap | R Documentation |
Build a treemap.
e_treemap(
e,
styles = NULL,
names = NULL,
levels = NULL,
rm_x = TRUE,
rm_y = TRUE,
...
)
e_treemap_(
e,
styles = NULL,
names = NULL,
levels = NULL,
rm_x = TRUE,
rm_y = TRUE,
...
)
e |
An |
styles |
Vector of style lists, defaults to |
names |
Names of items to style, expects a |
levels |
Hierarchical levels to style, expects a |
rm_x, rm_y |
Whether to remove x and y axis, defaults to |
... |
Any other option to pass, check See Also section. |
library(dplyr)
df <- tibble(
name = c("earth", "mars", "venus"),
value = c(30, 40, 30),
# 1st level
itemStyle = tibble(color = c(NA, "red", "blue")),
# embedded styles, optional
children = list(
tibble(
name = c("land", "ocean"),
value = c(10, 20),
# 2nd level
children = list(
tibble(name = c("forest", "river"), value = c(3, 7)),
# 3rd level
tibble(
name = c("fish", "kelp"),
value = c(10, 5),
children = list(
tibble(name = c("shark", "tuna"), value = c(2, 6)),
# 4th level
NULL # kelp
)
)
)
),
tibble(name = c("crater", "valley"), value = c(20, 20)),
NULL # venus
)
)
df |>
e_charts() |>
e_treemap()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.