Provide ggplot2
fill scales like geoda software.Now it achieve by using
?ggplot2::scale_fill_manual()
.Another achieve can see
https://stackoverflow.com/questions/43440068/ggplot2-fix-colors-to-factor-l.
Author
Wenbo Lv lyu.geosocial@gmail.com
Examples
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(ggplot2)
guerry_path = system.file("extdata", "Guerry.shp", package = "rgeoda")
guerry = read_sf(guerry_path)
guerry |>
dplyr::mutate(lisa = st_local_moran(guerry,'Crm_prs')) |>
dplyr::select(lisa) |>
ggplot() +
geom_sf(aes(fill = lisa),lwd = .1,color = 'grey') +
scale_fill_lisa()