import numpy as np
import matplotlib.pyplot as plt
import pylab

# turn on latex
plt.rc('text', usetex=True)
# title and axis labels
plt.title(r'$V(x)$')
plt.xlabel(r'$x$')
plt.ylabel(r'$V(x)$')
#y2=plt.ylabel(r'$K(k,k^{\prime},k^{\prime})$')
#y3=plt.ylabel(r'$\mathbb{R}e(T(k,k^{\prime},k^{\prime}))$')
#y4 plt.ylabel(r'$\mathbb{I}m(T(k,k^{\prime},k^{\prime}))$')
#read file from out.dat
x, y = np.loadtxt('fig_1.dat', delimiter=None, unpack=True)
#r, s, t = np.loadtxt('psi_2.dat', delimiter=None, unpack=True)
#w, s, t, u  = np.loadtxt('r.dat', delimiter=None, unpack=True)
#turn on interactive mode - not necessary
plt.ion()
#plot limits
pylab.xlim(-5.0,5.0)
#plot commands with color symbol and label
pylab.plot(x,y,'b-',label='$V(x)$') 
#pylab.plot(r,s,'r--',label='$Re(\psi_i)$')
#pylab.plot(r,t,'k:',label='$Im(\psi_i)$')
#pylab.plot(s,u,'g:',label='$Im(\psi_r)$')
#labels
pylab.legend(loc='lower right')
plt.savefig('fig_1.pdf')
#plt.show()
