#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 #------------------------------------- #Load data #--------------------------------------- data=np.loadtxt('linear_data.dat') #--------------------------------------- #Font and latin accents #------------------------------ rcParams['text.latex.unicode']=True #Enable Unicode pl.rc('font',family='serif') #Use a serif font #Plot Figure #---------------------------------- ax1 = pl.subplot() #Plot the xs versus ys vector ax1.plot(data[:,0], data[:,1], label='My First Plot', lw='0.8', color='red') #Draws an arbitrary line [xi,xf], [yi,yf] ax1.plot([4,4 ], [0, 26], linestyle='--', lw=0.5) #----------------------------------- #General plot elements #------------------------------------- pl.xlabel(u"EnergĂ­a [eV]", x=0.5, y=0) #X label pl.ylabel(u"Position [m]", x=0.0, y=0.5) #Y label pl.xlim(0.0, 10.0) # X range pl.ylim(0, 26) # Y range pl.legend(loc=2, bbox_to_anchor=(0.30, 0.95),prop={'size':10}) #Legend format #------------------------------------- #Add text in the plot #------------------------------------- ax1.text(1, 5, r'$\alpha_i = \sum_{i=0}^\infty x_i$', fontsize=23) #Intructions for the exit format: png, eps, ps, svg #--------------------------------------------------- pl.savefig('simple_enhanced.png',format='png', dpi=400) pl.show()