rchoroplethcolor-paletter-mapviewviridis

Changing Viridis to different color palette


How can one change this viridis color platte as shown below to other types of viridis color palette??The code used and the map displayed below is shown for reference: enter image description here


Solution

  • The col.regions option does that. You can give it a different color palette as an argument:

    library(mapview)
    data(franconia)
    mapview(franconia, 
            zcol = "district",  
            col.region=colorRampPalette(c("blue", "red")))
    

    Created on 2022-06-03 by the reprex package (v2.0.1)