metrosim/docs/plots/metro1_cumprobs.py

38 lines
987 B
Python

import matplotlib.pyplot as plt
from metro1_data import tas, cum_probs
# 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.step(tas, cum_probs, 'o-', color='blue', where='post')
idx = 3
epsilon = (cum_probs[idx] + cum_probs[idx+1]) / 2
ta_star = tas[idx+1]
plt.plot([tas[0], ta_star], [epsilon, epsilon],
linestyle='dashed', color='black')
plt.annotate(r'$\epsilon$', (tas[0], epsilon), va='center', ha='right')
plt.xlabel('$ta$')
plt.ylabel('$F$')
plt.xlim(tas[0], tas[-1])
plt.ylim(bottom=0)
plt.tight_layout()
plt.show()