R 树图分类自定义颜色正 - 绿色,负 - 红色

问题描述

我正在寻找 R 中 treemap 包的解决方案,以使用分类变量显示自定义颜色。

  bing.sentiment %>%
  group_by(sentiment) %>%
  top_n(10) %>%
  ungroup() %>%
  mutate(word = reorder(word,n)) %>%
  treemap(
        index="word",vSize="n",type= "categorical",vColor = "sentiment",palette = "Spectral"
        )

我找不到正确的函数。树形图如下所示:

Treemap with only red color ...

我真的很想将正场涂成绿色。

有人知道怎么做吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)