Summary
Graph data
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv("data.tsv", index_col=0 , sep = "\t")
df = df.fillna(0)
df = df.sort_values("Total")
fig, ax = plt.subplots(figsize=(16, 8))
ax.bar(df.index, df["Inpatient"] , color="#93CDDD", width=0.7, bottom=0)
ax.bar(df.index, df["Outpatient"], color="#957ccb", width=0.7, bottom=df["Inpatient"] )
ax.bar(df.index, df["Long-term care"], color="#E69717", width=0.7 , bottom=df["Inpatient"]+df["Outpatient"] )
ax.bar(df.index, df["Ancillary services"] , color="#D83227", width=0.7, bottom=df["Inpatient"]+df["Outpatient"] + df["Long-term care"] )
ax.bar(df.index, df["Medical goods"] , color="#3cb371", width=0.7, bottom=df["Inpatient"]+df["Outpatient"] + df["Long-term care"] + df["Ancillary services"] )
ax.bar(df.index, df["Preventive care"] , color="#D676AB", width=0.7, bottom=df["Inpatient"]+df["Outpatient"] + df["Long-term care"] + df["Ancillary services"] + df["Medical goods"] )
ax.bar(df.index, df["Administration"] , color="#a52a2a", width=0.7, bottom=df["Inpatient"]+df["Outpatient"] + df["Long-term care"] + df["Ancillary services"] + df["Medical goods"] + df["Preventive care"])
ax.bar(df.index, df["Others"] , color="#aaa", width=0.7, bottom=df["Inpatient"]+df["Outpatient"] + df["Long-term care"] + df["Ancillary services"] + df["Medical goods"] + df["Preventive care"] + df["Administration"] )
ax.legend(df.columns, fontsize=12, ncol=5, loc='center' ,bbox_to_anchor=(0., -0.23, 1., .102) )
ax.set_axisbelow(True)
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
plt.subplots_adjust(left=0.05, bottom=0.22, right=0.96, top=0.8)
plt.title("Health expenditure by function, 2018 (OECD Health)", fontsize=28)
plt.tick_params(labelsize=10, pad=4)
plt.xticks(df.index, rotation=40, size=9)
plt.ylim([0,16])
plt.ylabel("% of GDP", size=15)
plt.yticks(fontsize=13)
plt.grid(which='major',color='#cccccc',linestyle='-', axis="y")
plt.subplots_adjust(top =0.88)
plt.savefig("image.svg")
==Licensing==
I, the copyright holder of this work, hereby publish it under the following license:
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication .
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.en CC0 Creative Commons Zero, Public Domain Dedication false false
English Add a one-line explanation of what this file represents