Add Color Palette to MapView-Map
Asked Answered
C

1

6

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'
Comstockery answered 6/2, 2020 at 16:16 Comment(0)
H
17

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"))

enter image description here

Hanfurd answered 6/2, 2020 at 19:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.