常用情况
mycol<-colorRampPalette(c("#be002f","#ef7a82","white"))(100)
#设置渐变色
参数
colorRamp(colors, bias = 1, space = c("rgb", "Lab"),
interpolate = c("linear", "spline"), alpha = FALSE)
colorRampPalette(colors, ...)
colors | colors to interpolate; must be a valid argument to |
bias | a positive number. Higher values give more widely spaced colors at the high end. |
space | a character string; interpolation in RGB or CIE Lab color spaces. |
interpolate | use spline or linear interpolation. |
alpha | logical: should alpha channel (opacity) values be returned? It is an error to give a true value if |
... | arguments to pass to |
个性化图例
将0设置为NA,不进行展示
data4[which(data4 == 0)] <- NA ##将0设置为NA
##这时会显示灰色或者白色框
##图例的个性化设置方法1
legend_breaks = -1:4, legend_labels = c("0",
"1e-4", "1e-3", "1e-2", "1e-1", "1")
#方法二
breaks = seq(-1, -0.5, length.out = 101), # 设置图例展示范围