日本の人口統計(1920~2024)
  • 各県の統計データ(棒グラフ)
  • コロプレス図
Plot.plot({
  style: "overflow: visible;",
  y: {grid: true, transform: (f) => Math.log10(f)},
  marks: [
    Plot.ruleY([0]),
    Plot.lineY(d_pop, {x: "year", y: "value", stroke: "prefectures", tip: "x"}),
    Plot.text(d_pop, Plot.selectLast({x: "year", y: "value", z: "prefectures", text: "prefectures", textAnchor: "start", dx: 2}))
  ],
  caption: "日本の人口の推移(対数変換、1920~2024年)",
})
Plot.plot({
  marginBottom: 60,
  x: {
    tickRotate: -90,
  },
  y: {
    grid: true,
  },
  marks: [
    Plot.ruleY([0]),
    Plot.barY(d_pop_year, {x: "prefectures", y: "value", sort: {x: "y", reverse: true},
    fill: "steelblue", tip: "x"})
  ],
  caption: caption_pop,
})
Plot.plot({
  marginBottom: 60,
  x: {
    tickRotate: -90,
  },
  y: {
    grid: true,
  },
  marks: [
    Plot.ruleY([0]),
    Plot.barY(d_sex_year, {x: "prefectures", y: "value", sort: {x: "y", reverse: true},
    fill: "steelblue", tip: "x"})
  ],
  caption: caption_sex,
})
Plot.plot({
  marginBottom: 60,
  x: {
    tickRotate: -90,
  },
  y: {
    grid: true,
  },
  marks: [
    Plot.ruleY([0]),
    Plot.barY(d_sex_ratio, {x: "prefectures", y: "value", sort: {x: "y", reverse: true},
    fill: "steelblue", tip: "x"})
  ],
  caption: "性別人口比(男性/女性)",
})
Plot.plot({
  marginBottom: 60,
  x: {
    tickRotate: -90,
  },
  y: {
    grid: true,
    labelAnchor: "center",
  },
  color: {
    scheme: "PiYG",
    type: "ordinal"
  },
  marks: [
    Plot.ruleY([0]),
    Plot.barY(d_pinc_year, {x: "prefectures", y: "value", 
      fill: (d) => d.value > 0, sort: {x: "y", reverse: true}, tip: "x"})
  ],
  caption: caption_pinc,
})
Plot.plot({
  marks: [
    Plot.geo(
      prefectures,
      {fill: (d) => d_pop_map.get(d.properties.name)}
    ),
    Plot.tip(prefectures, Plot.pointer(Plot.geoCentroid({title: (d) => d.properties.name})))
  ],
    caption: caption_pop,
    color: {
    scheme: "spectral",
    unknown: "#ddd",
    type: "linear", 
    legend: true,
    label: legend_text_pop,
    domain: [0, 13000],
  }
})
選択した県・年の統計データ

人口(千人)

d_pop_pref[0].value

性別人口(千人)

d_sex_pref[0].value

人口増加率

d_pinc_pref[0].value

Plot.plot({
  marks: [
    Plot.geo(
      prefectures,
      {fill: (d) => d_sex_map.get(d.properties.name)}
    ),
    Plot.tip(prefectures, Plot.pointer(Plot.geoCentroid({title: (d) => d.properties.name})))
  ],
    caption: caption_sex,
    color: {
    scheme: "spectral",
    unknown: "#ddd",
    type: "linear", 
    legend: true,
    label: legend_text_sex,
    domain: [0, 6500],
  }
})
Plot.plot({
  marks: [
    Plot.geo(
      prefectures,
      {fill: (d) => d_pinc_map.get(d.properties.name)}
    ),
    Plot.tip(prefectures, Plot.pointer(Plot.geoCentroid({title: (d) => d.properties.name})))
  ],
    caption: caption_pinc,
    color: {
    scheme: "spectral",
    unknown: "#ddd",
    type: "linear", 
    legend: true,
    label: legend_text_pinc,
  }
})
import { aq, op } from "@uwdata/arquero"
d_pop = FileAttachment("d_pop_24.csv").csv({ typed: true })
d_sex = FileAttachment("d_sex_24.csv").csv({ typed: true })
d_pinc = FileAttachment("d_pinc_24.csv").csv({ typed: true })
legend_text_pop = "Population in " + year + " in Japan (thouthand)"
caption_pop = "Population in " + year + " in Japan (thouthand)"
legend_text_sex = "Population of " + sex + " in " + year + " in Japan (thouthand)"
caption_sex = "Population in " + year + " in Japan (thouthand, " + "sex: " + sex + ")"
legend_text_pinc = "Increase rate of population in " + year + " in Japan"
caption_pinc = "Increase rate of population in " + year + " in Japan (%)"
prefectures = FileAttachment("prefectures2.geojson").json()
d_pop_year = d_pop
  .filter((d) => d.year == year)
d_pop_map = new Map(d_pop_year.map(({prefectures, value}) => [prefectures, value]))
d_sex_year = d_sex
  .filter((d) => d.year == year && d.sex == sex)
d_sex_ratio = d_sex
  .filter((d) => d.year == year && d.sex == "ratio")
d_sex_map = new Map(d_sex_year.map(({prefectures, value}) => [prefectures, value]))
d_pinc_year = d_pinc
  .filter((d) => d.year == year)
d_pinc_map = new Map(d_pinc_year.map(({prefectures, value}) => [prefectures, value]))
d_pop_pref = d_pop_year
  .filter((d) => d.prefectures == select_pref)
d_sex_pref = d_sex_year
  .filter((d) => d.prefectures == select_pref)
d_pinc_pref = d_pinc_year
  .filter((d) => d.prefectures == select_pref)
viewof year = Inputs.range([1920, 2024], {label: "Year", step: 1, value: 2024})
viewof sex = Inputs.radio(["male", "female"], {label: "性別", value: "male"})
viewof select_pref = Inputs.select(["北海道","青森県","岩手県","宮城県","秋田県","山形県","福島県","茨城県","栃木県","群馬県","埼玉県","千葉県","東京都","神奈川県",
"新潟県","富山県","石川県","福井県","山梨県","長野県","岐阜県",
"静岡県","愛知県","三重県","滋賀県","京都府","大阪府","兵庫県",
"奈良県","和歌山県","鳥取県","島根県","岡山県","広島県","山口県",
"徳島県","香川県","愛媛県","高知県","福岡県","佐賀県","長崎県",
"熊本県","大分県","宮崎県","鹿児島県","沖縄県"], {label: "都道府県"})

年
year

Geojsonの出典:47都道府県のポリゴンデータ geojson(Japonyolブログ)

データの出典:「政府統計の総合窓口(e-Stat)」、統計データを探す-人口統計「我が国の推計人口(大正9年~平成12年)」

及び 「政府統計の総合窓口(e-Stat)」、統計データを探す-人口統計「長期的時系列データ(大正9年~平成12年)」

及び 「政府統計の総合窓口(e-Stat)」、統計データを探す-人口統計「各年10月1日現在人口 - (年次)」

データは長期にわたるもので、統計取得方法が必ずしも同じではないこと、データ処理の一部は手作業で行っているため、正確ではない場合があります。Quarto - Observableのサンプルとして作成しました。