R 中的分类树图不显示所有类别

Categorical treemap in R does not show all the categories

我在 R 中玩树状图,当我尝试分类树状图时,树状图只显示一个类别。我想重现树形图 examples in Tableau but the categorical example is not giving me a correct treemap. The data is public and it is from Tableau website. It can be downloaded from here.

如果我想按数字列为矩形着色,它工作正常。

library(readxl)
library(dplyr)
Sample_Superstore <- read_excel("Sample_Superstore.xls")
grouped=Sample_Superstore%>%select(`Sub-Category`,Sales,`Ship Mode`)%>%
           group_by(`Sub-Category`,`Ship Mode`)%>%summarise(Total_Sales=sum(Sales))

用于着色的数字列(效果很好!)

treemap(grouped, 
 index="Sub-Category", 
 vSize="Total_Sales", 
 vColor="Total_Sales",
 type="value",
 title = "",
 palette="BuGn", #"Blues" 
 border.col ="white"
)

使用分类变量着色(无效)

它只显示一个类别,但我的数据有四个类别。

treemap(grouped, 
 index="Sub-Category", 
 vSize="Total_Sales",  
 vColor="Ship Mode",
 type="categorical"
)

treemap(grouped, 
        index=c("Ship Mode", "Sub-Category"), 
        vSize="Total_Sales",  
        vColor="Ship Mode",
        type="categorical"
)