Fixed color for specific value
colors, r
Solution
I used this solution :
col = colorRampPalette(c("darkmagenta","blue","green","yellow","orange","red"),
space="Lab")(NBR.COLORS)
breaks = c(seq(-35, 10, length.out=NBR.COLORS/2), 10,
seq(10, 35, length.out=NBR.COLORS/2))
image.plot(akima.smooth, col=col, breaks=breaks, main=main_title,
horizontal=TRUE,axes=TRUE);
Problem
I am trying to make a temperature map, all works fine but I don't know how to have a fixed color palette. Actually I have this : ``` rgb.palette <- colorRampPalette(c("blue","green","yellow","orange","red"), space = "Lab") image.plot(akima.smooth, col = rgb.palette(NBR.COLORS), main=main_title, horizontal=TRUE, axes=TRUE) ``` This solution works but the colors which are painted are always from blue to red. For example if the lowest temperature on the map is -10°C the color will be blue, but in another map if the lowest temperature is +25°C that color will be blue too. How can I define a fixed color panel such as : ``` -30°C => blue -20°C => light blue -10°C => dark green 0°C => green 10°C => yellow ``` If in map 1 lowest temperature is -20 I want "light blue" and in map 2 if lowest temperature is 10°C I want "yellow" color.