简体   繁体   English

R Treemap 指定树图中的RGB colors

[英]R Treemap specify the RGB colors in the treemap

I have the following but have been unsuccessful being able to specify the three RGB color codes I want to represent each part of the treemap.我有以下但未能成功指定我想要代表树状图每个部分的三个 RGB 颜色代码。

Enter the data for tree map:输入树 map 的数据:

treedata <- data.frame(people = c("A","B", "C"), x = c(15,10,5))

Make our treemap:制作我们的树图:

FigA <-treemap(treedata,
        index="people",
        vSize="x",
        type="index",
        title=""
)

The three RBG colors I want for A, B, C respectively are #b5e3ff, #8f8eb1, #f6adca A、B、C我要的三个RBG colors分别是#b5e3ff、#8f8eb1、#f6adca

I've been through all help but can't find someone specifying the color to the category using RGB.我已经通过所有帮助,但找不到使用 RGB 为类别指定颜色的人。

try this:试试这个:

treedata <- data.frame(people = c("A","B", "C"), x = c(15,10,5),
    mycolors =  c("#b5e3ff", "#8f8eb1", "#f6adca") )

treemap(treedata,
    index="people",
    vSize="x",
    title="",
    type="color",
    vColor = "mycolors"
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM