#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 #--------------------------------------- ir1 = np.loadtxt('first_ir.dat', delimiter=" ") ir2 = np.loadtxt('second_ir.dat', delimiter=" ") #--------------------------------------- #Plot Figure #---------------------------------- fig = pl.figure(1) ax1=pl.subplot() ax1.plot(ir1[:,0], ir1[:,1], label='First IR', lw='0.8', color='red') ax1.plot(ir2[:,0], ir2[:,1], label='Second', lw='1.5', color='blue') #General plot elements #------------------------------------- pl.xlabel(r'Frequency [cm]$^{-1}$', x=0.5, y=0) #X label pl.ylabel("Absorbance arb. unit.", x=0.0, y=0.5) #Y label pl.legend(loc=1, bbox_to_anchor=(0.30, 0.95),prop={'size':10}) #Intructions for the exit format: png, eps, ps, svg #--------------------------------------------------- pl.savefig('ir_lines.png',format='png', dpi=400) pl.show()