import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.ticker as ticker
import matplotlib.cm as cm
df1 = pd.read_csv("data.tsv", index_col=0 , sep = "\t")
df2 = pd.read_csv("data2.tsv", index_col=0 , sep = "\t")
df = pd.merge(df1, df2, on='Country', how='outer')
fig, ax = plt.subplots(figsize=(8, 8))
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = ['Noto Sans Display']
plt.subplots_adjust(left=0.1, bottom=0.1, right=0.97, top=0.91)
cmap = cm.get_cmap('tab20b')
i = 0
for k, v in df.iterrows():
plt.scatter(v[0] , v[1] , color=cmap(i) )
ax.annotate(k, xy=(v[0]+0.03,v[1]+0.03), color=cmap(i) , size=10, alpha=0.8)
i = 0 if i>len(cmap.colors) else i+1
plt.title("Physicians and Doctor consultants per capita, 2018 \n(OECD Health Statistics)", fontsize=16)
plt.xlabel("Physicians per capita (person)", fontsize=12)
plt.ylabel("Doctors cousultations per capita (Number)", fontsize=12)
plt.xticks(fontsize=8)
plt.yticks(fontsize=8)
plt.xlim([1,6])
plt.ylim([1,18])
ax.xaxis.set_major_locator(ticker.MultipleLocator(1))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
ax.set_axisbelow(True)
plt.grid(which='major',color='#eeeeee',linestyle='-', axis="x", zorder=-1)
plt.grid(which='major',color='#eeeeee',linestyle='-', axis="y", zorder=-1)
plt.grid(which='minor',color='#fafafa',linestyle='-', axis="x", zorder=-1)
plt.savefig("image.svg")