# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
#Direct input
plt.rcParams[‘text.latex.preamble’]=r’\usepackage{lmodern}’
#Options
params = {‘text.usetex’:True,’font.size’:11,’font.family’:’serif’,’figure.autolayout’: True}
plt.rcParams.update(params)
# Data for plotting
k1 = 3
k2 = 1
x1 = np.linspace(-10, 15, 200)
wf1 = np.cos(k1*x1)
wf2 = np.exp(-0.07*x1)
wf3 = np.exp(-0.07*5)*np.cos(1.5*(x1-5))
fig, (ax1,ax2,ax3) = plt.subplots(1,3, gridspec_kw={‘wspace’:0,’width_ratios’: [2, 1,2]},sharey=True)
ax1.plot(x1,wf1,’–b’,label=r’$Re[\psi_1(x)]$’)
ax1.legend(loc=’upper left’,fontsize=16, fancybox=True, framealpha=0.0)
ax2.plot(x1,wf2,’r’,label=r’$\psi_2(x)$’)
ax2.legend(loc=’upper left’,fontsize=12, fancybox=True, framealpha=0.0)
ax3.plot(x1,wf3,’–g’,label=r’$Re[\psi_3(x)]$’)
ax3.legend(loc=’upper left’,fontsize=16, fancybox=True, framealpha=0.0,labelcolor=’linecolor’)
ax1.set_xlim((-10,0))
ax2.set_xlim((0,5))
ax2.set_ylim((-1.2,1.6))
ax3.set_xlim((5,15))
ax2.set_xlabel(r’$x$’,fontsize=18)
ax2.yaxis.set_ticks_position(‘none’)
ax3.yaxis.set_ticks_position(‘none’)
fig.savefig(“wavefunction.pdf”)
plt.show(block=False)