我正在使用以下代码创建调色板:
library(rgl)
fv.colors = colorRampPalette(c("white","tan4","green"))
colorlut = terrain.colors(100)[c(100,95,90,85,80,75:30,25,20,15,14:1)]
col = colorlut[fv-trnlim[1]+1 ]
这给出了这个:(颜色条是根据提供的代码创建的here https://i.stack.imgur.com/5NoJh.jpg)
我想要的是 0 处的一条白色条带,就像我目前所拥有的那样,但随后在 0.01 处彻底中断,调色板将start在“tan4”,而不是现在的情况,即逐渐从白色变为“tan4”(实际上,它永远不会像 tan4 一样暗)。
很抱歉,如果这是一个非常简单的答案,但经过多次尝试和谷歌搜索,我仍然无法解决。
Thanks!
对您的代码进行小的修改似乎可以提供您想要的答案:
fv.colors = colorRampPalette(c("white","tan4","green")) ## define the color ramp
colorlut = fv.colors(100)[c(1,seq(50,100,length.out=99))] ## select colors to use
plot(0:1,0:1,type='n',xaxs='i',yaxs='i') ## define the plotting area
## illustrate the vector of colors using rectangles
rect(seq(0,0.99,0.01),rep(0,100),seq(0.01,1,0.01),rep(1,100),col = colorlut,border = NA)
box() ## make sure that the graph's frame is not covered up
Edit:在我看来,颜色有点难看,但您可以通过重新定义颜色渐变或从渐变中选择颜色来调整它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)