【R】都道府県別 塩消費量
2020年1月11日
2018年の都道府県別の塩消費量を日本地図へ可視化してみます。
library(leaflet)
dat <- read.csv("http://www.dinov.tokyo/Data/JP_Pref/Pref_data.csv", header = TRUE,
fileEncoding="UTF-8")
datc_m <- cut(dat$しお, hist(dat$しお, plot=FALSE)$breaks, right=FALSE)
datc_mcol <- rainbow(length(levels(datc_m)))[as.integer(datc_m)]
windowsFonts(JP1=windowsFont("MS Gothic"),
JP2=windowsFont("MS Mincho"),
JP3=windowsFont("Meiryo"),
JP4=windowsFont("Biz Gothic"))
windows(width=800, height=800)
par(family="JP4")
library(NipponMap)
JapanPrefMap(datc_mcol, main="2018年度都道府県別 一人当たりの塩消費量 g ")
legend("bottomright", fill=rainbow(length(levels(datc_m))), legend=names(table(datc_m)))

想像通り、東北地方が多いです。