map_coloring | R Documentation |
Finds colors for every element of a shapefile so that adjacent elements don't have the same color.
map_coloring(shp, min_coloring = TRUE)
shp |
an |
min_coloring |
if |
an integer vector of the same length as shp
, corresponding to the
coloring.
data(oregon)
or_short = oregon[30:50, ]
map_coloring(or_short)
library(ggplot2)
ggplot(or_short, aes(fill = map_coloring(or_short))) +
geom_sf() +
theme_map()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.