我想将传单调色板的中心设置为零(红白绿绿色发散)。我已经尝试了这篇文章中所说的。当我尝试手动创建颜色时,出现了红色绿色发散,但无法将其居中为零。
我的密码
regions@data <- data.frame(region <- c("APAC (excl. China)", "Africa",
"Americas", "Europe", "Greater China", "Middle East"),
change_targeted <- c(36,-21,25,4,173,34))
color = "#666"
weight = 0.5
opacity = 1
fillOpacity = 1
dashArray = ""
hl_color = "black"
hl_weight = 1
hl_dashArray = ""
library(RColorBrewer)
nHalf = nrow(regions@data)/2
Min = min(regions@data[,"change_targeted"])
Max = max(regions@data[,"change_targeted"])
Thresh = 0
## Make vector of colors for values below threshold
rc1 = colorRampPalette(colors = c("red", "white"), space="Lab")(nHalf)
## Make vector of …Run Code Online (Sandbox Code Playgroud)