【发布时间】:2022-11-18 14:34:42
【问题描述】:
目的是为因子值提供固定颜色。我很难将 colorFactor 比例应用于 mapview 对象。但是,调色板似乎与 zcol 不匹配。
我尝试了以下,类似于传单地图。
library(mapview)
colors <- colorFactor(palette = c("Red", "Green", "Blue"),
levels = c("Oberfranken","Mittelfranken", "Unterfranken"))
mapview(franconia, zcol = "district",col.regions=colors)
我收到以下错误消息:
1: In col.regions(nregions) : Some values were outside the color
scale and will be treated as NA
有什么帮助吗?
以下将适用于传单,但不使用 mapview。
franconia %>% leaflet() %>% addTiles() %>% addPolygons(fillColor = ~colors(district))
【问题讨论】: