簡體   English   中英

R Treemap 指定樹圖中的RGB colors

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

我有以下但未能成功指定我想要代表樹狀圖每個部分的三個 RGB 顏色代碼。

輸入樹 map 的數據:

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

制作我們的樹圖:

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

A、B、C我要的三個RBG colors分別是#b5e3ff、#8f8eb1、#f6adca

我已經通過所有幫助,但找不到使用 RGB 為類別指定顏色的人。

試試這個:

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