rnso
rnso

Reputation: 24593

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))

enter image description here

Upvotes: 1

Views: 1460

Answers (1)

jazzurro
jazzurro

Reputation: 23574

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. 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))

enter image description here

If I set bias at 0.9, this is the outcome. enter image description here

If I set bias at 0.1 This is the outcome enter image description here

Upvotes: 2

Related Questions