sns.set()
#Plot.
fig = plt.figure(figsize = (13, 8))
ax = fig.add_subplot()
#Main Title.
ax.set_title("Leaves Changing and Falling", fontsize = 24)
ax.plot_date(x = dates,
y = leaves,
c = '#22A884FF',
markersize = 5,
zorder = 1)
ax.plot_date(x = [equinox, maxd, solstice],
y = [0, 1/math.e, 0],
c = '#414487FF',
markersize = 10,
zorder = 2)
ax.xaxis_date()
ax.set_xlabel(xlabel = "Autumnal Equinox to Winter Solstice", fontsize = 18)
ax.xaxis.set_major_formatter(DF('%b %d'))
ax.set_ylabel(ylabel = "Trees with Leaves Changing", fontsize = 18)
ax.yaxis.set_major_formatter(PF(1))
ax.tick_params(axis = 'both', rotation = 30, labelsize = 14)
#Annotations
texte = DT(2022, 9, 29, 12)
textd = DT(2022, 11, 2, 12)
texts = DT(2022, 12, 19, 12)
variables = [("36.79% of trees will", (textd, 0.30), "left"),
("have changing leaves", (textd, 0.28), "left"),
("at 15:41 on November 18th.", (textd, 0.26), "left"),
("21:03 on", (texte, 0.03), "left"),
("September 22nd.", (texte, 0.01), "left"),
("16:47 on", (texts, 0.03), "right"),
("December 21st.", (texts, 0.01), "right")]
for v in variables:
plt.annotate(v[0], v[1],
c = '#414487FF',
fontsize = 20,
fontweight = "bold",
ha = v[2],
va = "bottom")
plt.savefig("2022.11.04 Classic.png")