Useful Plotting Functions#
You can define reusable functions to apply consistent styling across multiple subplots.
def setup_axis(ax, ymin, ymax, y_major, y_minor):
ax.set_xlim(1900, 2025)
ax.set_ylim(ymin, ymax)
ax.xaxis.set_minor_locator(MultipleLocator(2))
ax.yaxis.set_minor_locator(MultipleLocator(y_minor))
ax.tick_params(axis="both", which="major", length=7)
ax.tick_params(axis="both", which="minor", length=4)
ax.grid(visible=True, which="major", linestyle="-", linewidth=0.7, alpha=0.7)
ax.grid(visible=True, which="minor", linestyle="--", linewidth=0.4, alpha=0.5)
Use this in your time series panels to standardize appearance.