Answers:
这是一个非常简单的例子
library(raster)
data(volcano)
volcanoR <- raster(volcano)
#making colors below 100 red and above 180 blue in this example
breakpoints <- c(94,100,120,140,160,180,195)
colors <- c("red","white","white","white","white","blue")
plot(volcanoR,breaks=breakpoints,col=colors)
您只需要向图传递一个断点矢量和一个颜色矢量以匹配断点。请检查RColorbrewer
包装,以获取一些非常好的内置色带。还要检查classInt
包装以制作断点。