I'm trying to change the colours of a map (shapefile data), created by a code similar to this:
mapView(MyData, zcol="Column_Name")
The "Help" page gives two different ways to change colour by using color=
or col.regions=
.
I would like to add a specific palette (YlGn
), but haven't found a way to do so. All it says is:
Error in col2rgb(colors, alpha = alpha) : invalid color name 'YlGn'
Here is an example that should clarify the point.
library(mapview)
library(sf)
library(RColorBrewer)
mapview(franconia, zcol = "SHAPE_LEN", col.regions=brewer.pal(9, "YlGn"))