#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np

# E, Zcom, standard error for top, hollow, bridge
ru1100 = np.array(
[[74.0,2.055347083333333,0.06269397299424573,1.8075314866666667,0.045568089830114775,1.8480957899999997,0.042432054214837034],
[87.8,2.002079992857143,0.046172914447463624,1.8273835645454541,0.053158403921203044,1.8217696528571428,0.02487348619269427],
[102.9,1.9500796794117647,0.019481873169747636,1.7665666694444444,0.042948263742982475,1.7364625623684211,0.019916731580698427],
[119.5,2.01070221375,0.07204498353754923,1.7945317816666666,0.03381800574389904,1.7848676770833336,0.020371363643839634]]
)

ru475 = np.array(
[[102.9,2.0233516889473684,0.02584064084475796,1.7827380784090912,0.024461922277533202,1.818766147246377,0.015023910463364508],
[119.5,1.983737484230769,0.020083013882408636,1.7739816247058826,0.02062792804903393,1.7930104819658117,0.013152292738096727]]
)

mpl.rc("text", usetex=True)
fig = plt.figure(figsize=(3.69,3))
#fig, ax = plt.subplots(nrows=2, ncols=1, figsize=(3.69,3.))

#plt.subplot(2,1,1)

plt.errorbar( ru1100[:,0], ru1100[:,1], yerr=ru1100[:,2], marker='o', label='Top', color='b' )
plt.errorbar( ru1100[:,0], ru1100[:,3], yerr=ru1100[:,4], marker='o', label='Hollow', color='r' )
plt.errorbar( ru1100[:,0], ru1100[:,5], yerr=ru1100[:,6], marker='o', label='Bridge', color='g' )
plt.errorbar( ru475[:,0], ru475[:,1], yerr=ru475[:,2], marker='o', label='', linestyle='--', markerfacecolor='none', markeredgecolor='b', color='b')
plt.errorbar( ru475[:,0], ru475[:,3], yerr=ru475[:,4], marker='o', label='', linestyle='--', markerfacecolor='none', markeredgecolor='r', color='r')
plt.errorbar( ru475[:,0], ru475[:,5], yerr=ru475[:,6], marker='o', label='', linestyle='--', markerfacecolor='none', markeredgecolor='g', color='g')
plt.plot([0., 400.], [2.035,2.035], linestyle=':', color='b', label='')#TS
plt.plot([0., 400.], [1.8555,1.8555], linestyle=':', color='r', label='')#Hu et al hollow
plt.plot([0., 400.], [1.796,1.796], linestyle=':', color='g', label='')#Hu et al bridge

plt.legend(loc='best', numpoints=1, frameon=False)
#plt.legend(loc='upper left', numpoints=1, handletextpad=0.5, borderaxespad=0.2, frameon=False)
plt.xlim(60.,130.)
plt.ylim(1.7,2.4)
plt.tick_params(length=6, width=1)
plt.ylabel(r'Z$_{N}$ (\r{A})')
plt.xlabel('Incidence energy (kJ/mol)')

plt.tight_layout()
plt.subplots_adjust(wspace=0, hspace=0)
plt.savefig('Zn_ts_site.pdf')
#plt.show()
