hgch_treemap | R Documentation |
Creates a treemap chart using Highcharter library.
hgch_treemap(data, dic = NULL, var_cat = NULL, var_num = NULL, ...)
data |
a data frame containing the variables to be plotted. |
dic |
a named list, each element corresponding to a column name in |
var_cat |
a character vector with the names of categorical variables. |
var_num |
a character vector with the names of numerical variables. |
... |
additional arguments to be passed to |
a Highcharter treemap chart.
data_draw
data(mtcars)
mtcars$cyl <- as.character(mtcars$cyl)
mtcars <- mtcars |>
dplyr::group_by(cyl) |>
dplyr::summarise(mpg = mean(mpg))
hgch_treemap(mtcars,
var_cat = "cyl",
var_num = "mpg")
### Custom labels
data <- ggplot2::diamonds
data <- data |>
dplyr::group_by(cut) |>
dplyr::summarise(price_sum = sum(price)),
agg = "sum",
group_var = "cut",
to_agg = "price")
# Define custom layers
ops <- list(title = "title",
subtitle = "subtitle",
caption = "caption",
hor_title = "Categorias",
ver_title = "Numeros",
bar_orientation = "hor")
hgch_treemap(data,
var_cat = "cut",
var_num = "price_sum",
opts = ops)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.