import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
df = pd.read_csv("data2.tsv", index_col=0 ,sep = "\t")
fig, ax = plt.subplots(ncols=2, figsize=(8,6) )
plt.subplots_adjust(left=0.02, bottom=0.1, right=0.98, top=0.90)
plt.rcParams'font.family' = 'sans-serif'
plt.rcParams'font.sans-serif' = 'Noto Sans Display'
# Man
ax0.barh(df.index, df'Man'], color='#ADD1E9', height=0.8, label='Man')
ax0.yaxis.tick_right()
ax1.yaxis.set_major_locator(ticker.MultipleLocator(5))
ax0.set_xlim([650,0])
ax0.xaxis.set_major_locator(ticker.MultipleLocator(50))
ax0.yaxis.set_major_locator(ticker.MultipleLocator(5))
ax0.tick_params(axis='x', labelsize=8, rotation=15)
ax0.tick_params(axis='y', labelsize=8)
ax0.set_axisbelow(True)
ax0.grid(True, which='major',color='#eeeeee',linestyle='-', axis="x")
#Woman
ax1.barh(df.index, df'Woman'], color='#EED4D4', height=0.8, label='Woman')
ax1.set_xlim([0,650])
ax1.xaxis.set_major_locator(ticker.MultipleLocator(50))
ax1.yaxis.set_major_locator(ticker.MultipleLocator(5))
ax1.tick_params(axis='x', labelsize=8, rotation=15)
ax1.tick_params(axis='y', labelsize=8)
ax1.set_axisbelow(True)
ax1.grid(True, which='major',color='#eeeeee',linestyle='-', axis="x")
ax1.set_xlabel('1000 person',loc="right")
plt.suptitle("Population Projections for Japan 2065 (IPSS,2017)\n (Middle-birth,Middle-mortality scinario)", fontsize=14)
fig.legend( facecolor="#eeeeee" , ncol=2, loc='lower center')
plt.savefig("image.svg")