knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(geohclust) library(sf) library(dplyr) library(tibble) library(ggplot2) library(ggpubr)
data("modesshare") #deplist = c(75,77,78,91,92,93,95,94) deplist=37 idf = modesshare |> filter(DEP %in% deplist)
res=geohclust_poly(idf,"ward") plot(res)
idf_agg=geocutree(res,k=80) |> rowwise(cl) |> mutate(total = sum(c_across(nodep:tcom))) idf = idf |> rowwise(CODE_IRIS) |> mutate(total = sum(c_across(nodep:tcom)))
map1=ggplot(idf)+geom_sf(aes(fill=tcom/total),size=0.2)+theme_bw()+scale_fill_distiller("Gauche :",palette = "Reds",direction = 1,limits=c(0,0.75)) map2=ggplot(idf_agg |> st_centroid())+geom_sf(data=idf_agg,fill="white",color="black")+geom_sf(aes(color=tcom/total,size=total))+theme_bw()+scale_color_distiller("Gauche :",palette = "Reds",direction = 1,limits=c(0,0.75))+scale_size_area(max_size = 9) ggarrange(map1,map2,nrow = 1,common.legend = TRUE)
data("modesshare")
#res=geohclust_poly(modesshare,method = "ward") #fr_agg2k=geocutree(res,2000) #fr_agg10k=geocutree(res,1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.