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
ax[0].barh(df.index, df['Man'], color='#ADD1E9', height=0.8, label='Man')
ax[0].yaxis.tick_right()
ax[1].yaxis.set_major_locator(ticker.MultipleLocator(5))
ax[0].set_xlim([650,0])
ax[0].xaxis.set_major_locator(ticker.MultipleLocator(50))
ax[0].yaxis.set_major_locator(ticker.MultipleLocator(5))
ax[0].tick_params(axis='x', labelsize=8, rotation=15)
ax[0].tick_params(axis='y', labelsize=8)
ax[0].set_axisbelow(True)
ax[0].grid(True, which='major',color='#eeeeee',linestyle='-', axis="x")
#Woman
ax[1].barh(df.index, df['Woman'], color='#EED4D4', height=0.8, label='Woman')
ax[1].set_xlim([0,650])
ax[1].xaxis.set_major_locator(ticker.MultipleLocator(50))
ax[1].yaxis.set_major_locator(ticker.MultipleLocator(5))
ax[1].tick_params(axis='x', labelsize=8, rotation=15)
ax[1].tick_params(axis='y', labelsize=8)
ax[1].set_axisbelow(True)
ax[1].grid(True, which='major',color='#eeeeee',linestyle='-', axis="x")
ax[1].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")