R中的调色板不均衡

时间:2014-08-19 11:21:40

标签: r

我正在尝试使用调色板的代码。但是,它显示的绿色比其他颜色更多。为什么会这样,如何纠正?谢谢你的帮助。

mypal = colorRampPalette(c("blue", "green", "yellow", "red"))
pie(rep(1,100),col=mypal(100))

enter image description here

1 个答案:

答案 0 :(得分:1)

我一直在研究this page,并了解到至少有两个参数可以玩。一个是偏见,另一个是空间。在我看来,space =“Lab”会影响我电脑屏幕上的颜色派。用我的眼睛,我现在可以在馅饼中感受到更多紫色的颜色。可能值得更多地使用这两个参数,看看你能用眼睛看到什么样的变化。我希望这能帮到您。这对我来说是一次很好的学习经历。

mypal = colorRampPalette(c("blue", "green", "yellow", "red"), bias = 0.5, space="Lab")
pie(rep(1,100),col=mypal(100))

enter image description here

如果我将偏差设定为0.9,那就是结果。 enter image description here

如果我将偏差设为0.1,这就是结果 enter image description here