| hgch_sankey | R Documentation | 
Creates a sankey chart using Highcharter library.
hgch_sankey(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 | the names of the categorical variables in the data frame | 
| var_num | a character vector with the name of numerical variable. | 
| ... | additional arguments to be passed to  | 
a Highcharter sankey chart.
data_draw
data <- ggplot2::diamonds
data <- data |>
  dplyr::group_by(cut, clarity) |>
  dplyr::summarise(total = sum(z, na.rm = T))
hgch_sankey(data, var_cat = c("cut", "clarity"), var_num = "total")
### Adding style to plot
test_theme <- list(
  theme = list(
    palette_colors = "#ffa92a",
    caption_align = "right",
    caption_family = "Roboto",
    caption_size = 15,
    caption_color = "#3b83b8",
    caption_weight = 700
  )
)
data <- dplyr::starwars
data <- data |>
  dplyr::select(hair_color, sex) |>
  tidyr::drop_na()
hgch_sankey_CatCat(data,
                   opts = test_theme,
                   caption = "theme caption")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.