need some help and would be grateful for any advice. I want to create an interactive treemap in R. So far, so good, so bad. I managed that and was able to create an HTML widget, but when I open it, the legend isn't there anymore. In the original plot it is still there, but not as a saved file. I would be grateful for tips! this is my code:
library(tidyverse) library(readr) library(lubridate) library(ggthemes) library(treemap) library(d3treeR) library(readxl) library(htmlwidgets) df <- read_excel("df.xlsx")
Tidydata <- df %>% group_by(Level1, Level2, Level3) %>% summarise(Count = n())
tree <- treemap(Tidydata, index=c("Level1", "Level2", "Level3") ,vSize="Count" ,vColor="Count", type="value", border.col=c("black","white"), palette = "Greens", title="Treemap",
fontsize.title=16, fontsize.labels = 7, title.legend = "Counts" )
int <- d3tree(tree,width = "200%", height ="600px", rootname = "Level1")
saveWidget(int, file="TreePlot.html", selfcontained = T)