Drawing agricultural community boundaries
This package may be beneficial, especially for R beginners, when simply wanting to draw agricultural community boundaries.
library(fude)
library(dplyr)
library(ggplot2)
library(gghighlight)
library(ggrepel)
b <- get_boundary("38", path = "~/ma", quiet = TRUE)
eb <- extract_boundary(b, city = "松山市", kcity = "浅海|立岩|難波|正岡|北条|河野|粟井")
ggplot(data = eb, aes(fill = kcity_name)) +
geom_sf(alpha = .2) +
geom_sf_text(
aes(label = rcom_name),
size = 2,
family = "Hiragino Sans"
) +
theme_void()
出典:農林水産省「農業集落境界データ(2025年度)」を加工して作成。
eb <- extract_boundary(b, city = "", rcom = "大浦", layer = TRUE)
ggplot(data = eb$city) +
geom_sf(aes(fill = fill)) +
theme_void()
出典:農林水産省「農業集落境界データ(2025年度)」を加工して作成。
ggplot(data = eb$kcity) +
geom_sf(aes(fill = fill)) +
theme_void()
出典:農林水産省「農業集落境界データ(2025年度)」を加工して作成。
ggplot() +
geom_sf(data = eb$city) +
geom_sf(
data = eb$rcom,
aes(fill = key)
) +
scale_fill_discrete(
name = "農業集落",
labels = eb$rcom$rcom_name
) +
theme_void()
出典:農林水産省「農業集落境界データ(2025年度)」を加工して作成。
eb <- extract_boundary(b, city = "西予市", kcity = "遊子川", layer = TRUE)
ggplot() +
geom_sf(
data = eb$pref,
fill = NA
) +
geom_sf(
data = eb$city,
fill = "gray"
) +
gghighlight(
fill == 1,
unhighlighted_params = list(
alpha = .05
)
) +
geom_sf(
data = eb$kcity |> filter(fill == 1),
fill = "black"
) +
geom_sf_text(
data = eb$city |> filter(fill == 1),
aes(label = city_name),
size = 3,
nudge_x = -.025, nudge_y = -.025,
family = "Hiragino Sans"
) +
geom_point(
data = eb$rcom_union,
aes(x = x, y = y),
colour = "black"
) +
geom_text_repel(
data = eb$rcom_union,
aes(x = x, y = y),
label = "遊子川地区",
nudge_x = .3, nudge_y = -.025,
segment.color = "black",
size = 3,
family = "Hiragino Sans"
) +
theme_void()
出典:農林水産省「農業集落境界データ(2025年度)」を加工して作成。
eb <- extract_boundary(b, city = "八幡浜市", kcity = "真穴", layer = TRUE)
ggplot(data = eb$city |> filter(fill == 1)) +
geom_sf(fill = "gray") +
geom_sf_text(
aes(label = city_name),
family = "Hiragino Sans"
) +
geom_sf(
data = eb$rcom,
fill = "ivory"
) +
# geom_sf(
# data = eb$fude,
# aes(fill = land_type),
# colour = NA
# ) +
geom_sf_label(
data = eb$rcom,
aes(label = rcom_name),
family = "Hiragino Sans"
) +
theme_void() +
theme(legend.position = "none")
出典:農林水産省「農業集落境界データ(2025年度)」を加工して作成。