import numpy as np
import pylab as pl

def str2ar(s):
    return np.array(map(float, s.split()))

x = str2ar("""
-4.7434	-2.3071	-2.3930
-3.6929	-1.6812	-1.8840
-3.4698	-1.1437	-1.7124
-3.4883	-1.1659	-1.7798
-3.4115	-1.1364	-1.6878
-3.4013	-1.1447	-1.6664
-3.4476	-1.1695	-1.7005""").reshape(7, 3).T.copy()

labels = 'O fcc', 'CO top edge', 'CO 111 top'

pl.figure(figsize=(4, 5))

pl.axhline(-3.4927, ls='--', lw=2, color='b')
pl.axhline(-1.2250, ls='--', lw=2, color='g')
pl.axhline(-1.6742, ls='--', lw=2, color='r')

for i, x1 in enumerate(x):
    pl.plot(x1, marker='o', lw=2, label=labels[i])
pl.xticks(range(7), '13 55 147 309 561 923 1415'.split(), rotation=90)
pl.subplots_adjust(bottom=0.2, left=0.2)
pl.axis(xmin=-0.5, xmax=6.5)
pl.xlabel('Number of cluster atoms')
pl.ylabel('Adsorption energy / eV')
pl.legend(loc='best')
pl.show()

