R 中的 Treemap 包:对第一个索引参数使用不同的调色板,对 vColor 变量使用不同的阴影 [英] Treemap package in R: use different palettes for first index parameter and shade for the vColor variable
问题描述
Treemap
包似乎比 portfolio
包中的 treemap
函数具有更多的功能.但是来自 参考手册(非常好,顺便说一句)不清楚是否可以为第一个索引参数使用不同的调色板并使用颜色的阴影(从几乎白色到定义的颜色)来映射第二个索引项(vColor
).我在做这样的事情:http://visualrevenue.com/media/uploaded_images/新闻聚合-treemap.jpg
Treemap
package in R seems to have more features than the treemap
function in portfolio
package. However from the reference manual (which is very good, btw) it does not become clear, whether it is possible to use different color palettes for the first index parameter and use shade (from almost white to the defined color) of a color to map the second index term (vColor
). I am after something like this: http://visualrevenue.com/media/uploaded_images/news-aggregation-treemap.jpg
举个例子,我想要拥有不同颜色(蓝色、绿色、红色等)的大陆,而 GNI 的颜色阴影将是通用的(例如在 alpha 尺度上).该示例来自参考手册.
As an example I would like to have continents with different colors (blue, green, red, etc) while the shading of the color for GNI would be universal (for example on alpha scale). The example is from the reference manual.
data(GNI2010)
# create treemap
tmPlot(GNI2010,
index=c("continent", "iso3"),
vSize="population",
vColor="GNI",
type="value")
这在当前的 treemap
包中是可能的还是需要对 tmPlot
代码进行重大修改?
Is this possible in current treemap
package or does it need major revisions of tmPlot
code?
推荐答案
我非常喜欢你的想法.
不幸的是,当前版本无法实现.但是,当然可以将这个功能实现到 tmPlot 中,虽然它并不简单(但也不是那么困难).我会加入待办事项列表以备下次更新.
Unfortunately it is not possible with the current version. However, it is certainly possible to implement this feature into tmPlot, although it is not straightforward (but also not that difficult). I'll put in on the todo list for the next update.
这篇关于R 中的 Treemap 包:对第一个索引参数使用不同的调色板,对 vColor 变量使用不同的阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!