我在R中创建了一个具有三个下钻级别的高图树图。我注意到,超过2个级别,地图变得怪异,整个地图挤进最外面的父母之一,而其他父母都是空的,像这样:
这是我的代码:
#set up
library(treemap)
library(highcharter)
set.seed(12345)
level1 <- letters[1:3]
level2 <- as.character(1:2)
level3 <- c("%", "*")
df <- expand.grid(level1, level2, level3)
df$size <- sample(20, nrow(df), replace=T)
df$color <- sample(20, nrow(df), replace=T)
tm <- treemap(df, index = c("Var1", "Var2", "Var3"),
vSize = "size", vColor = "color",
type = "value")
hc_tm <- highchart(height = 800) %>%
hc_add_series_treemap(tm, allowDrillToNode = TRUE,
layoutAlgorithm = "squarified",
name = "tmdata")
hc_tm
我在这里缺少什么?谢谢你的帮助。