## Here space="rgb" gives palettes that vary only in saturation, as
## intended. With space="Lab" the steps are more uniform, but the hues
## are slightly purple.
filled.contour(volcano, color =colorRampPalette(c("red","white","blue")), asp = 1)
filled.contour(volcano, color = colorRampPalette(c("red","white","blue"),space="Lab"), asp = 1)
## Interpolating a 'sequential' ColorBrewer palette
YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")
filled.contour(volcano, color = colorRampPalette(YlOrBr,space="Lab"), asp = 1)
filled.contour(volcano, color = colorRampPalette(YlOrBr,space="Lab",bias=0.5), asp = 1)
## space="Lab" helps when colors don't form a natural sequence
m<-outer(1:20,1:20,function(x,y) sin(sqrt(x*y)/3))
rgb.palette<-colorRampPalette(c("red","orange","blue"), space="rgb")
Lab.palette<-colorRampPalette(c("red","orange","blue"), space="Lab")
filled.contour(m,col=rgb.palette(20))
filled.contour(m,col=Lab.palette(20))
Run the code above in your browser using DataLab