## work with treemap and use treecolors
library(treemap)
library(treebar)
library(dplyr)
data_hier <- tidyr:::drop_na(random.hierarchical.data(depth=4)) %>%
inner_join(treepalette(.,index=names(.)[-ncol(.)])) %>%
mutate(color = HCL.color) %>%
select(-starts_with("HCL"))
d3r::d3_nest(data_hier, value_cols=c("x","color")) %>%
treebar(value="x")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.