I need a gradient function for two "sides", let me explain:
Example:
x <- c(1,4,3,4,5,6,1,8,9,3)
then I need a array of color, the number 5 is the main color blue and the smaller and larger numbers are the gradient to red.
I found this
colorRampPalette(c("red", "blue"))
but if I do:
colfunc <- colorRampPalette(c("red", "blue"))
colfunc(10)
Returns a color progression from red to blue ignoring the value...
How can I do this?
Ps: I don't use any library...