import matplotlib.pyplot as plt
from cycler import cycler
import pandas as pd
import matplotlib.ticker as ticker
df = pd.read_csv("data.tsv", index_col=0 , sep = "\t")
df1 = df.T.loc['Retired'] # line
df2 = df.T.loc['Officers'] # bar
fig, ax = plt.subplots(figsize=(10,5))
ax2 = ax.twinx()
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
plt.subplots_adjust(left=0.09, bottom=0.13, right=0.92, top=0.85)
plt.setp(ax.get_xticklabels(), fontsize=7)
plt.setp(ax.get_yticklabels(), fontsize=8)
ax.bar(df2.index, df2, color="#8EB4E3", width=0.6, label="Person")
ax.set_axisbelow(True)
ax.tick_params(axis='x', labelrotation=50)
ax.set_ylabel("Person", size=10)
ax.xaxis.set_major_locator(ticker.MultipleLocator(4))
ax.set_ylim([0,950000])
ax2.set_ylim([0,950000])
ax.yaxis.set_major_locator(ticker.MultipleLocator(100000))
ax2.plot(df1, label="Retired", color="#C0504D")
ax2.set_yticklabels([])
ax2.set_yticks([])
lines, labels = ax.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax2.legend(lines + lines2, labels + labels2, facecolor="#eeeeee" ,fontsize=10, ncol=2, loc='upper right')
ax.margins(0.01)
plt.title("Civil servant persons for the general public service in Japan\n (National Personnel Authority)", fontsize=14)
plt.minorticks_on()
ax.grid(True, which='major',color='#cccccc',linestyle='-', axis="y")
ax.grid(True, which='minor',color='#eeeeee',linestyle='--', axis="y")
plt.savefig("image.svg")