I am trying to produce an interactive treemap in R using the highcharter-package (I love the package btw). It shall look like this (I don't even need the different levels)
Sample code:
df <- data.frame(name = c("john", "jane", "herbert", "peter"),
bananas = c(10, 14, 6, 3))
hctreemap2(df,
group_vars = "name",
size_var = "bananas")
I don't want the boxes to have gradient colors, but distinct, say red, yellow, green and blue. I'm getting better in understanding the highcharts-API and "translate" it to R-Code, but this really gives me a hard time.
I already found a work-arround, but I am looking for a better solution, as hc_add_series_treemap is deprecated.
p <- treemap(df,
index="name",
vSize="bananas",
type="index")
highchart() %>%
hc_add_series_treemap(p,
layoutAlgorithm = "squarified")
So thanks for your help :)