#!/usr/bin/env python

#########################################
import matplotlib
matplotlib.use('Agg')

import matplotlib.pyplot as plt		#
import numpy as np			#
from distribution import gauss_bin	#
from matplotlib import rc		#
#########################################

rc('mathtext', fontset ='stix')

ibounce = np.array([i for i in range (5)])

impact_count = np.array([[0, 38, 8, 1, 0],
			 [0, 25, 12, 0, 0],
			 [0, 6, 7, 0, 0],
			 [0, 5, 12, 1, 0]])

ax = plt.subplot(321)
plt.bar(ibounce-0.3, impact_count[0], align = 'center', width = 0.2, color = 'blue', label = '95.4 kJ/mol')
plt.bar(ibounce-0.1, impact_count[1], align = 'center', color = 'red', width = 0.2, label = '106.8 kJ/mol')
plt.bar(ibounce+0.1, impact_count[2], align = 'center', color = 'green', width = 0.2, label = '118.8 kJ/mol')
plt.bar(ibounce+0.3, impact_count[3], align = 'center', color = 'black', width = 0.2, label = '124.6 kJ/mol')
plt.xlim([0.5,3.5])
plt.xticks(np.arange(1, 4, 1),fontsize = 12)
plt.yticks(fontsize = 12)
plt.yticks(np.arange(0, 50, 10),fontsize = 12)
#lg = ax.legend(loc = 'upper center', numpoints = 1, bbox_to_anchor=(0.5, -0.3), prop={'size': 14})
lg = ax.legend(loc = 'upper right', prop={'size': 11})
lg.draw_frame(False)
plt.xlabel('Number of Impacts', size = 12)
plt.ylabel('No. of Trajectories', size = 12)
plt.savefig('Figz.png',bbox_inches='tight', dpi = 600)
#plt.show()

