import matplotlib.pyplot as plt
from cycler import cycler
import pandas as pd
import matplotlib.ticker as ticker
import numpy as np
df = pd.read_csv("data.tsv", index_col=0 , sep = "\t").T
df = df.fillna(method = 'ffill')
fig, ax = plt.subplots(figsize=(12, 8))
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
cols = np.concatenate([plt.get_cmap("tab20")(np.linspace(0,1,20)), plt.get_cmap("tab20c")(np.linspace(0,1,20)) ])
plt.rcParams["axes.prop_cycle"] = plt.cycler("color",cols)
plt.subplots_adjust(left=0.05, bottom=0.13, right=0.96, top=0.95)
cc = cycler('ls', ['-', '--'] )
ax.set_prop_cycle( plt.rcParams['axes.prop_cycle'] *cc)
ax.plot(df, lw=1.5 )
ax.set_axisbelow(True)
ax.axhspan(0, 2.1, color="lightblue", alpha=0.4 , zorder=-10)
ax.xaxis.set_major_locator(ticker.MultipleLocator(2))
ax.margins(0.01)
fig.legend(df.columns, fontsize=8, ncol=10, loc='lower center' , frameon=True, facecolor="#eeeeee")
plt.title("Total fertility rate in OECD (OECD Family Database)", fontsize=16)
plt.tick_params(labelsize=9, pad=4)
plt.ylabel("Children", fontsize=11)
plt.xticks(rotation=35, fontsize=9)
plt.yticks(fontsize=11)
plt.ylim([0.8 ,3.5])
ax.minorticks_on()
plt.grid(which='major',color='#999999',linestyle='-', axis="y")
plt.grid(which='minor',color='#cccccc',linestyle='--', axis="y")
plt.savefig("image.svg")