import matplotlib.pyplot as plt from cycler import cycler import pandas as pd df = pd.read_csv("data.tsv", index_col=0 , sep = "\t").T dfline = df.loc['Effective copayment rate'] # line dfbar = df.loc['Medical cost per capita'] # bar fig, ax = plt.subplots(figsize=(8, 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.15, right=0.92, top=0.88) plt.setp(ax.get_xticklabels(), fontsize=9) plt.setp(ax.get_yticklabels(), fontsize=9) ax.set_xlabel("Population Age group", fontsize=10) ax.bar(dfbar.index, dfbar, color="#FAAA69", width=0.6) ax.set_axisbelow(True) ax.tick_params(axis='x', labelrotation=35) ax.set_ylim([0,1600]) ax.set_ylabel("Annual medical cost (Thousand JPY)", fontsize=10) ax.legend(['Medical cost'] ,facecolor="#eeeeee", fontsize=11,loc='upper left' ) ax.minorticks_on() ax.grid(which='major',color='#999999',linestyle='-', axis="y") ax.grid(which='minor',color='#dddddd',linestyle='--', axis="y") ax2.set_prop_cycle( plt.rcParams['axes.prop_cycle'] ) ax2.set_axisbelow(True) ax2.plot(dfline) ax2.set_ylim([0,40]) ax2.set_ylabel("Copayment Rate (Percentage)", fontsize=10) ax2.legend(['Copayment Rate'] ,facecolor="#eeeeee" ,fontsize=11,loc='upper right' ) plt.title("Annual medical cost and copayment rate in Japan\n by age group, 2020 (OECD Economic Survey 2024)", fontsize=14) plt.tick_params(labelsize=9, pad=4) plt.yticks(fontsize=9) plt.savefig("image.svg")