File:Foreign residents in Japan.svg

Original file(SVG file, nominally 1,080 × 540 pixels, file size: 249 KB)

Commons-logo.svg This is a file from the Wikimedia Commons. The description on its description page there is shown below.
Commons is a freely licensed media file repository. You can help.

Summary

Description
English: Foreign residents in Japan
Date
Source

Own work ,Data from National Institute of Population and Social Security Research (IPSS)

https://www.ipss.go.jp/syoushika/tohkei/Popular/Popular2022.asp?chap=0
Author Yuasan
Permission
(Reusing this file)
CC-0

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Graph data

import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.ticker as ticker

df = pd.read_csv("data.tsv", index_col=0 , sep = "\t")
df = df.fillna(0).div(1000, fill_value=0).fillna(0)

df1 = df.drop('Total', axis=1).T
df2 = df.T.loc['Total']

fig, ax = plt.subplots(figsize=(12, 6))
ax2 = ax.twinx()

ax.plot(df2, label="Total", color="#5E95CD")
ax.fill_between( df2.index ,0, df2.values,  color="lightblue", alpha=0.5)

for i in range( len(df1) ):
	ax2.bar(df1.columns, df1.iloc[i] , width=1, bottom=df1.iloc[:i].sum())

ax2.legend(df1.index, fontsize=10, ncol=4, loc='upper left',  frameon=True, facecolor="#dddddd")
ax.set_ylim([0,3000])
ax2.set_ylim([0,3000])

plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
plt.subplots_adjust(left=0.07, bottom=0.07, right=0.98, top=0.93)

plt.title("Foreign residents in Japan (IPSS)", fontsize=20)
plt.tick_params(labelsize=10, pad=4)
ax.set_ylabel("1000 Population", size=12)

plt.setp(ax.get_xticklabels(), fontsize=8, rotation=75)
plt.setp(ax.get_yticklabels(), fontsize=9 )
ax.xaxis.set_major_locator(ticker.MultipleLocator(2))
ax.yaxis.set_major_locator(ticker.MultipleLocator(250))

ax2.set_yticklabels([])
ax2.set_yticks([])

ax.minorticks_on()
ax.set_axisbelow(True)
ax2.set_axisbelow(True)
ax.grid(True, which='major',color='#cccccc',linestyle='-', axis="y")
ax.grid(True, which='minor',color='#eeeeee',linestyle='--', axis="y")
ax2.grid(None,which='major')

plt.savefig("image.svg")

Captions

Foreign residents in Japan

Items portrayed in this file

depicts

8 February 2023

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current05:36, 9 February 20231,080 × 540 (249 KB)Yuasanvalue add

The following page uses this file:

Metadata