Treemap package in R: use different palettes for first index parameter and shade for the vColor variable

蓝咒 提交于 2019-12-12 03:46:56

问题


Treemap package in R seems to have more features than the treemapfunction 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

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")

Is this possible in current treemap package or does it need major revisions of tmPlot code?


回答1:


I like your idea very much.

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.



来源:https://stackoverflow.com/questions/14223520/treemap-package-in-r-use-different-palettes-for-first-index-parameter-and-shade

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!