import matplotlib.pyplot as plt
from cycler import cycler
import pandas as pd
import matplotlib.ticker as ticker
df1 = pd.read_csv("data.tsv", index_col=0 ,sep = "\t", dtype="int64")
df2 = pd.read_csv("data2.tsv", index_col=0 ,sep = "\t", dtype="int64")
df = pd.merge(df1, df2, on='year', how='outer')
df["High-growth, High-participate"] = df["High-growth, High-participate"].ffill()
df["Middle-growth, Middle-participate"] = df["Middle-growth, Middle-participate"].ffill()
df["Zero-growth, Same-participate"] = df["Zero-growth, Same-participate"].ffill()
fig, ax = plt.subplots(figsize=(8, 5))
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
plt.subplots_adjust(left=0.09, bottom=0.18, right=0.96, top=0.9)
ax.set_prop_cycle( plt.rcParams['axes.prop_cycle'])
ax.margins(0.02)
ax.plot(df)
ax.fill_between( df.index ,0, df["Observed"].values, color="lightblue", alpha=0.5)
fig.legend(df.columns, fontsize=9, ncol=2, loc='lower center' ,frameon=True, facecolor="#dddddd")
ax.set_axisbelow(True)
plt.ylim([5000,7000])
plt.title("Labour force Projections for Japan (JLIPT,2024)", fontsize=16)
plt.tick_params(labelsize=9, pad=4)
plt.ylabel("10000 Population", fontsize=8)
plt.xticks(rotation=35, fontsize=7)
plt.yticks(fontsize=9)
ax.xaxis.set_major_locator(ticker.MultipleLocator(3))
plt.minorticks_on()
plt.grid(which='major',color='#eeeeee',linestyle='-', axis="x")
plt.grid(which='minor', linestyle='None', axis="x")
plt.grid(which='major',color='#cccccc',linestyle='-', axis="y")
plt.grid(which='minor',color='#eeeeee',linestyle='-', axis="y")
plt.savefig("image.svg")