#Libraries to manage different elements #-------------------------------------- from matplotlib import pyplot as pl import numpy as np #from matplotlib import rcParams #from matplotlib import gridspec ##import matplotlib.ticker as ticker #------------------------------------- #Read the files two columns from a file #--------------------------------------- total = np.loadtxt('total_dos.dat') ti = np.loadtxt('ti_dos.dat') ox = np.loadtxt('ox_dos.dat') #--------------------------------------- #Plot Figure #---------------------------------- fig = pl.figure(1) ax1=pl.subplot() ax1.fill(total[:,0], total[:,7], label='Total', alpha=0.4, color='gray') ax1.fill(total[:,0], total[:,8], label='', alpha=0.4, color='gray') ax1.plot(ti[:,0], ti[:,5], label='Ti (d)', lw=1.1, color='blue') ax1.plot(ti[:,0], ti[:,6], label='', lw=1.1, color='blue') ax1.plot(ox[:,0], ox[:,3], label='O (p)', lw=1.1, color='red') ax1.plot(ox[:,0], ox[:,4], label='', lw=1.1, color='red') #General plot elements #------------------------------------- pl.xlabel(r'Energy [eV]', x=0.5, y=0) #X label pl.ylabel("Density of States [states/eV]", x=0.0, y=0.5) #Y label pl.legend(loc=1, bbox_to_anchor=(0.30, 0.95),prop={'size':10}) pl.xlim(-8, 4) # X range pl.ylim(-15, 15) # Y range #Intructions for the exit format: png, eps, ps, svg #--------------------------------------------------- pl.savefig('dos_plot.png',format='png', dpi=400) pl.show()