Last active
July 19, 2022 15:06
-
-
Save ctesta01/6d84d24af94b1c11d7b031e4e2ce254e to your computer and use it in GitHub Desktop.
Example showing Blue/Orange Diverging Color Palette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(ggplot2) | |
nc <- st_read(system.file("shapes/sids.shp", package="spData")[1], quiet=TRUE) | |
nc %>% | |
ggplot(aes(fill = AREA)) + | |
geom_sf(size = 0.05, color = 'white') + | |
scale_fill_gradientn( | |
colors = c("#DA8907", "#ECCD00", "white", "#62AEDC", "#203856")) | |
nc %>% | |
ggplot(aes(fill = AREA)) + | |
geom_sf(size = 0.05, color = 'white') + | |
scale_fill_stepsn( | |
colors = c("#DA8907", "#ECCD00", "white", "#62AEDC", "#203856")) | |
# note that the breaks and range of values can be specified manually by using the values argument |
Author
ctesta01
commented
Jul 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment