-
-
- import fileinput
- import pylab
- import matplotlib.pyplot as plt
- from matplotlib import rc
- from math import *
- fig_width_pt = 246.0
- inches_per_pt = 1.0/72.27
- golden_mean = (sqrt(5)-1.0)/2.0
- fig_width = fig_width_pt*inches_per_pt
- fig_height = fig_width*golden_mean
- fig_size = [fig_width,fig_height]
- params = {'backend': 'ps',
- 'axes.labelsize': 20,
- 'text.fontsize': 20,
- 'legend.fontsize': 20,
- 'xtick.labelsize': 20,
- 'ytick.labelsize': 20,
- 'text.usetex': True,
- 'figure.figsize': fig_size}
- pylab.rcParams.update(params)
-
-
-
- rc('text', usetex=True)
- rc('font', family='serif')
-
-
- time_s=[]
- spot_p=[]
- forward_p=[]
- b_theta=[]
- kappa=[]
- for line in fileinput.input():
- items=line[:-1].split()
- spot_p.append(items[0])
- forward_p.append(items[1])
- b_theta.append(items[2])
- time_s.append(items[4])
- kappa.append(items[5])
- print items[0],items[1],items[2],items[3],items[4],items[5]
-
-
- fig = pylab.figure(1, figsize=(13,10))
- plt.xlabel('Time to maturity')
- plt.ylabel('Prices')
- plt.plot(time_s,spot_p,label='Spot price')
- plt.plot(time_s,forward_p,label='Forward price')
- plt.legend()
- plt.xlim([0, 1.6])
-
- plt.savefig('price_his.eps')
-
-
- fig = pylab.figure(2,figsize=(13,10))
- plt.xlabel('Time to maturity')
- plt.ylabel(r'$\kappa$')
- plt.plot(time_s,kappa,label=r'$\kappa$')
- plt.legend()
- plt.xlim([0, 1.6])
- plt.ylim([-10, 5])
-
- plt.savefig('kappa.eps')
-
-
- fig = pylab.figure(3,figsize=(13,10))
- plt.xlabel('Time to maturity')
- plt.ylabel(r'$\bar{\theta}$')
- plt.plot(time_s,b_theta,label=r'$\bar{\theta}$')
- plt.legend()
-
-
-
- plt.savefig('b_theta.eps')
#!/usr/bin/env python
import fileinput
import pylab
import matplotlib.pyplot as plt
from matplotlib import rc
from math import *
fig_width_pt = 246.0 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = (sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width,fig_height]
params = {'backend': 'ps',
'axes.labelsize': 20,
'text.fontsize': 20,
'legend.fontsize': 20,
'xtick.labelsize': 20,
'ytick.labelsize': 20,
'text.usetex': True,
'figure.figsize': fig_size}
pylab.rcParams.update(params)
#rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
rc('text', usetex=True)
rc('font', family='serif')
time_s=[]
spot_p=[]
forward_p=[]
b_theta=[]
kappa=[]
for line in fileinput.input():
items=line[:-1].split()
spot_p.append(items[0])
forward_p.append(items[1])
b_theta.append(items[2])
time_s.append(items[4])
kappa.append(items[5])
print items[0],items[1],items[2],items[3],items[4],items[5]
fig = pylab.figure(1, figsize=(13,10))
plt.xlabel('Time to maturity')
plt.ylabel('Prices')
plt.plot(time_s,spot_p,label='Spot price')
plt.plot(time_s,forward_p,label='Forward price')
plt.legend()
plt.xlim([0, 1.6])
#plt.show()
plt.savefig('price_his.eps')
fig = pylab.figure(2,figsize=(13,10))
plt.xlabel('Time to maturity')
plt.ylabel(r'$\kappa$')
plt.plot(time_s,kappa,label=r'$\kappa$')
plt.legend()
plt.xlim([0, 1.6])
plt.ylim([-10, 5])
#plt.show()
plt.savefig('kappa.eps')
fig = pylab.figure(3,figsize=(13,10))
plt.xlabel('Time to maturity')
plt.ylabel(r'$\bar{\theta}$')
plt.plot(time_s,b_theta,label=r'$\bar{\theta}$')
plt.legend()
#plt.xlim([0, 1.6])
#plt.ylim([-10, 5])
#plt.show()
plt.savefig('b_theta.eps')
