library("treemap")
library("viridis")
data(GNI2010)
head(GNI2010)
tm <- treemap(GNI2010, index = c("continent", "iso3"),
vSize = "population", vColor = "GNI",
type = "comp", palette = rev(viridis(6)),
draw = FALSE)
highchart(height = 800) %>%
hc_add_serie_treemap(tm, allowDrillToNode = TRUE,
layoutAlgorithm = "squarified",
name = "tmdata") %>%
hc_title(text = "Gross National Income World Data") %>%
hc_tooltip(pointFormat = "<b>{point.name}</b>:<br>
Pop: {point.value:,.0f}<br>
GNI: {point.valuecolor:,.0f}")
Run the code above in your browser using DataLab