N R
N R

Reputation: 83

R mapview choose color of polygon based on color code in column

I got polygon spatial data (could be points too) with a column specifying the color in hex. Could be something like:

colfunc <- colorRampPalette(c("gold1", "gold3"))
clrs <- colfunc(6)
names(clrs) <- c(0:5)

breweries$clrs <- clrs[match(breweries$number.seasonal.beers,names(clrs))]

Now I want mapview to set these colors as colors in the map to the according point (or polygon in my real data). I tried zcol and col.regions but it does not seem to work like this. Do you have any suggestions?

Upvotes: 2

Views: 134

Answers (0)

Related Questions