#!/usr/bin/env python """Prevalence of MS in Iran. Source of data: http://isna.ir/fa/news/95030301371/ """ import numpy as np import matplotlib.pyplot as plt years = (2008, 2011, 2014, 2015) per_100000 = (50, 73, 101, 115) ys = np.array(per_100000) xs = np.array(years) fig = plt.figure() ax = fig.add_subplot(111) axistexts = ax.set_xticklabels([str(x) for x in xs]) plt.setp(axistexts, fontsize=10, clip_on=False) plt.tick_params( axis='x', # changes apply to the x-axis which='both', # both major and minor ticks are affected bottom='off', # ticks along the bottom edge are off top='off', # ticks along the top edge are off labelbottom='on' # labels along the bottom edge are on ) plt.xlim(xs[0] - 1, xs[-1] + 1) plt.xticks(xs, xs) plt.xlabel('Year') plt.ylim(0, max(ys) + min(ys)) plt.yticks() plt.ylabel('MS cases per 100,000 people') plt.plot(xs, ys, '--ro') plt.grid(True) for x, y in zip(xs, ys): plt.text(x, y - 10, str(y), ha='center', va='bottom') plt.savefig('MS_in_Iran_2008-2015.svg') plt.show()