import matplotlib.pyplot as plt
import seaborn as sns
#Time values and labels.
fid_t = [0, 10, 40/3, 50/3, 20]
fid_tl = ['0', '10', '13 1/3', '16 2/3', '']
#Distance values and labels.
fid_d = [0, 1/2, 2/3, 1]
fid_dl = ['0', '1/2', '2/3', 'Home']
#Alice, Bob, & Carey
fid_a = [a - 0.015 for a in [0, 1, 2/3, 1, 1]]
fid_b = [0, 1/2, 2/3, 1, 1]
fid_c = [c + 0.015 for c in [0, 1, 1, 1, 1]]
#Time values and labels.
ec_t = [0, 10, 40/3, 50/3, 160/9, 170/9, 20]
ec_tl = ['0', '10', '13 1/3', '16 2/3', '17 7/9', '18 8/9', '']
#Distance values and labels.
ec_d = [0, 1/2, 2/3, 5/6, 8/9, 1]
ec_dl = ['0', '1/2', '2/3', '5/6', '8/9', 'Home']
#Alice, Bob, Carey, & Dee
ec_a = [a - 0.0225 for a in [0, 1, 2/3, 1, 8/9, 1, 1]]
ec_b = [b - 0.0075 for b in [0, 1/2, 2/3, 5/6, 8/9, 1, 1]]
ec_c = [c + 0.0075 for c in [0, 1, 1, 1, 1, 1, 1]]
ec_de = [d + 0.0225 for d in [0, 1/2, 2/3, 1, 1, 1, 1]]
#Colors.
c = ['#5DC863', '#21908C', '#3B528B', '#440154']
#Names.
n = ['Alice', 'Bob', 'Carey', 'Dee']
def pancakes(x_val, x_lab, y_val, y_lab, ymax, y, c, n, t) :
sns.set()
#Plot.
fig = plt.figure(figsize = (12, 7))
ax = fig.add_subplot(xlim = (0, 20), ylim = (0, ymax))
#Title.
ax.set_title("Fastest Way to Get Home", fontsize = 24)
#x-axis.
ax.set_xlabel("Minutes after Call", fontsize = 18, labelpad = -10)
plt.xticks(ticks = x_val, labels = x_lab)
plt.xticks(rotation = 45)
#y-axis.
ax.set_ylabel("Fraction of Distance to Home", fontsize = 18)
plt.yticks(ticks = y_val, labels = y_lab)
ax.tick_params(axis = 'both', labelsize = 16)
for i in range(t):
ax.plot(x_val, y[i], lw = 5, c = c[i], label = n[i])
ax.legend(fontsize = '14', loc = 'lower right')
fig.savefig('2024.01.19 Fiddler' + str(t-2) + '.png');
pancakes(fid_t, fid_tl, fid_d, fid_dl, 1.025,
[fid_a, fid_b, fid_c],
c, n, 3)
pancakes(ec_t, ec_tl, ec_d, ec_dl, 1.03,
[ec_a, ec_b, ec_c, ec_de],
c, n, 4)