Im converts colors to HSV to reassign color. In fact, I am generating a gray gradient with gray.colors :
(mydata <- 1 : 10)
However, what I really want is a gradient of white and red, not white and black. Fiddling around with the color picker convinced me that for this it should be enough to change the value and saturation to the colors of shades of gray, and then set the value to 1 (hue 0 already matches red).
Voting is easier:
hsvc <-rgb2hsv(col2rgb(cols)) hsvc['s', ] <- hsvc['v', ] hsvc['v', ] <- 1
However, to build these values, I now need to convert them back to color values โโof R. It seems that I can not do this due to the lack of hsv2col . Of course, theres hsv that claims to be this, but you cannot name it with the hsvc value above - even with one column:
hsv(hsvc[, 1])
And R cannot directly use HSV values:
plot(1, 1, pch = 20, col = cols[1])
How to get the returned R color values โโback from the HSV value matrix?
source share