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.filter(like='00',axis=0).T
df2 = df.loc['Total tax revenue'].T
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.07, bottom=0.22, right=0.96, top=0.93)
plt.setp(ax.get_xticklabels(), fontsize=7)
plt.setp(ax.get_yticklabels(), fontsize=8)
ax.bar(df2.index, df.loc['Total tax revenue'].T, color="lightblue")
ax.set_ylim([0,35])
ax.set_axisbelow(True)
ax.tick_params(axis='x', labelrotation=35)
ax.set_ylabel("Total Revenue (% of GDP)", fontsize=15, color="#30579f")
ax.tick_params(axis='y', colors='#30579f')
ax2.set_prop_cycle( plt.rcParams['axes.prop_cycle'] )
ax2.plot(df1)
ax2.set_ylim([0,14])
ax2.legend(df1.columns, fontsize=9, ncol=2, loc='center' ,bbox_to_anchor=(0., -0.27, 1., 0.102) ,facecolor="#eeeeee" )
ax2.set_ylabel("Revenue (% of GDP)", fontsize=10)
plt.title("Revenue of Japan Government, Total, % of GDP (OECD Revenue)", fontsize=15)
plt.tick_params(labelsize=9, pad=4)
plt.grid(which='major',color='#cccccc',linestyle='-', axis="y")
ax.minorticks_on()
ax.yaxis.set_major_locator(ticker.MultipleLocator(2.5))
ax.yaxis.set_minor_locator(ticker.MultipleLocator(1.25))
ax.grid(False, which='minor', axis="x")
ax.grid(True, which='major',color='#cccccc',linestyle='-', axis="y")
ax.grid(True, which='minor',color='#eeeeee',linestyle='--', axis="y")
ax2.yaxis.set_major_locator(ticker.MultipleLocator(1))
ax2.grid(False, which='both', axis="both")
plt.savefig("image.svg")