import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv("data.tsv", index_col=0 , sep = "\t")
df['row_sum'] = df.sum(axis=1)
df = df.sort_values('row_sum').drop(columns='row_sum')
fig, ax = plt.subplots(figsize=(16, 8))
ax.bar(df.index, df["Employees"] , color="#5E95CD", width=0.7, bottom=0)
ax.bar(df.index, df["Employers"], color="#D676AB", width=0.7, bottom=df["Employees"] )
ax.bar(df.index, df["Selfemployed or nonemployed"], color="#9BBB59", width=0.7 , bottom=df["Employees"]+df["Employers"] )
ax.legend(df.columns, fontsize=20, loc='upper left',)
ax.set_axisbelow(True)
ax.margins(x=0.01)
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
plt.subplots_adjust(left=0.05, bottom=0.1, right=0.96, top=0.92)
plt.title("Social security contributions as % of GDP, 2023 (OECD Revenue stat)", fontsize=23)
plt.tick_params(labelsize=10, pad=4)
plt.xticks(rotation=40)
plt.yticks(fontsize=15)
plt.minorticks_on()
plt.grid(which='major',color='#cccccc',linestyle='-', axis="y")
plt.grid(which='minor',color='#eeeeee',linestyle='-', axis="y")
plt.savefig("image.svg")