Reputation: 2253
I have produced a map of Denmark
library(leaflet.extras)
library(leaflet)
#Data
folk1 <- readr::read_csv2("http://api.statbank.dk/v1/data/folk1a/CSV?OMR%C3%85DE=*")
municipalityDK("INDHOLD","OMRÅDE",data=folk1,legend=T,pal = "GnBu") %>%
setMapWidgetStyle(list(background= "white"))
Which looks like:
However, I have not succeeded in finding a color palette that visualizes data the way I prefer. I have used those listed here.
I would like the color palette to look like this:
Can this be done manually?
Upvotes: 2
Views: 568
Reputation: 30539
You can create a custom palette with RColorBrewer
:
library(RColorBrewer)
colfunc <- colorRampPalette(c("#2C77BF", "red"))
Then include your custom palette and number of selected colors in your map:
municipalityDK("INDHOLD","OMRÅDE",data=folk1,legend=T,pal = colfunc(10)) %>%
setMapWidgetStyle(list(background= "white"))
Map
Upvotes: 3