// Determine line function
line_func = lambda x: x*slope + intercept
// Get "x" points within limit and map to "y" coordinates
x_points = np.linspace(min(xlim),max(xlim),100)
y_points = np.array(map(line_func,x_points))
// detemine which points are still within the limit of the plot
in_range = np.logical_and(y_points > min(ylim),
y_points < max(ylim))
After Change
ax.set_autoscale_on(False)
xlim = ax.get_xlim()
_x = np.array([np.min(xlim), np.max(xlim)])
for i in range(len(slope)):
_y = _x * slope[i] + intercept[i]
ax.plot(_x, _y,
linewidth=linewidth[i],
linestyle=linestyle[i],
alpha=alpha[i],