File:Foreign residents in Japan.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

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

Captions

Captions

Foreign residents in Japan

Summary[edit]

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[edit]

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[edit]

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")

File history

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

Date/TimeThumbnailDimensionsUserComment
current12:36, 9 February 2023Thumbnail for version as of 12:36, 9 February 20231,080 × 540 (249 KB)Yuasan (talk | contribs)value add
12:09, 9 February 2023Thumbnail for version as of 12:09, 9 February 20231,080 × 540 (226 KB)Yuasan (talk | contribs)stretch
03:53, 9 February 2023Thumbnail for version as of 03:53, 9 February 20231,080 × 540 (212 KB)Yuasan (talk | contribs)Uploaded own work with UploadWizard

The following page uses this file:

File usage on other wikis

Metadata