I want my x-axis to be a thick line, so I created an axhline at y=0. However autoscale considers the line when it calculates the y-axis range. I want it to ignore the axhline at 0, and focus on the plotted data (even if that means axhline does not show in that particular instance). I created a very simple sample case below (where I would prefer autoscale to pick a y-axis range of something closer to 12-18:
import matplotlib.pyplot as plt
import numpy as np
x = [1, 2, 3, 4, 5, 6, 7]
y = [15, 16, 13, 17, 18, 14, 13]
fig, ax = plt.subplots()
ax.axhline(linewidth=2, color='k', zorder=1)
ax.plot(x, y)