简体   繁体   English

R中的调色板不平衡

[英]Color palette not balanced in R

I am trying following code for a color palette. 我正在尝试遵循调色板的代码。 However, it shows more green than other colors. 但是,它比其他颜色显示更多的绿色。 Why is this and how can this be corrected? 为什么会这样,如何纠正呢? Thanks for your help. 谢谢你的帮助。

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

在此处输入图片说明

I have been looking into this page and learned that there are at least two parameters you can play with. 我一直在浏览此页面,并了解到至少可以使用两个参数。 One is bias and the other is space . 一个是偏见 ,另一个是空间 It seems to me that space ="Lab" affects the colour pie on my computer screen. 在我看来,空格=“ Lab”会影响计算机屏幕上的颜色派。 With my eyes, I can perceive more purple like colours in the pie now. 用我的眼睛,我现在可以感觉到馅饼中更多的紫色像颜色。 It is probably worth playing with the two parameters more and see what kind of change you can perceive with your eyes. 可能值得更多地使用这两个参数,并看看您能用眼睛看到什么样的变化。 I hope this will help you. 我希望这能帮到您。 This was good learning experience for me. 对我来说,这是一次很好的学习经历。

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

在此处输入图片说明

If I set bias at 0.9, this is the outcome. 如果我将偏差设置为0.9,这就是结果。 在此处输入图片说明

If I set bias at 0.1 This is the outcome 如果我将偏差设为0.1,这就是结果 在此处输入图片说明

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

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