【发布时间】:2016-03-10 11:33:08
【问题描述】:
RColorBrewer 允许您获得少量视觉上令人愉悦的颜色,如下所示:
> library(RColorBrewer)
> brewer.pal(11, "Spectral")
[1] "#9E0142" "#D53E4F" "#F46D43" "#FDAE61" "#FEE08B" "#FFFFBF" "#E6F598"
[8] "#ABDDA4" "#66C2A5" "#3288BD" "#5E4FA2"
但是,如果您要求的金额超过该金额,他们只会给您相同的最高金额:
> brewer.pal(12, "Spectral")
[1] "#9E0142" "#D53E4F" "#F46D43" "#FDAE61" "#FEE08B" "#FFFFBF" "#E6F598"
[8] "#ABDDA4" "#66C2A5" "#3288BD" "#5E4FA2"
Warning message:
In brewer.pal(12, "Spectral") :
n too large, allowed maximum for palette Spectral is 11
Returning the palette you asked for with that many colors
如果提供更大的颜色,是否有可能获得更多的颜色(可能通过在最远的颜色之间进行插值)?
【问题讨论】:
-
什么颜色?您可以预定义它们并保留您最喜欢的列表。或类似
plot(1:10, col = colorRampPalette(c('red','blue','green'))(10), pch = 16, cex = 3) -
这正是我想要的。提交,我会接受! (附注:我用
colorRampPalette(brewer.pal(11, "Spectral"))(n)表示我正在寻找的n -
@rhombidodedecahedron 您可以查看 R 中颜色和调色板的简短介绍:research.stowers-institute.org/efg/Report/UsingColorInR.pdf
-
我觉得these answers更有帮助
-
更新到 Henrik 的链接 research.stowers.org/mcm/efg/Report/UsingColorInR.pdf