metrosim/docs/plots/metro1_tt.py

43 lines
1.2 KiB
Python

import matplotlib.pyplot as plt
from metro1_data import tas, tts, t_star, t_star_tt
# Update matplotlib parameters.
params = {'text.usetex': True,
'figure.dpi': 200,
'font.size': 14,
'font.serif': [],
'font.sans-serif': [],
'font.monospace': [],
'axes.labelsize': 16,
'axes.titlesize': 18,
'axes.linewidth': .6,
'legend.fontsize': 14,
'xtick.labelsize': 12,
'ytick.labelsize': 12,
'font.family': 'serif'}
plt.rcParams.update(params)
plt.figure(figsize=(7, 5))
plt.plot(tas, tts, 'o-')
plt.plot([tas[0], t_star, t_star], [t_star_tt, t_star_tt, 0],
linestyle='dashed', color='black')
plt.annotate('$t^*$', (t_star, 0), (t_star, -.5), va='top', ha='center')
plt.annotate(r'$\hat{tt}$', (tas[0], t_star_tt), (tas[0]-.05, t_star_tt),
va='center', ha='right')
idx = 3
plt.plot([tas[idx], tas[idx+1], tas[idx+1]], [tts[idx], tts[idx], tts[idx+1]],
linestyle='dashed', color='black')
plt.annotate(r'$\delta_i$', ((tas[idx]+tas[idx+1])/2, (tts[idx]+tts[idx+1])/2),
va='top', ha='left')
plt.xlabel('$ta$')
plt.ylabel('$tt$')
plt.xlim(tas[0], tas[-1])
plt.ylim(bottom=0)
plt.tight_layout()
plt.show()