In regards to your request for a function to change the y-axis limits, would this suit your purposes?:
def larger_axlim( axlim ):
""" argument axlim expects 2-tuple
returns slightly larger 2-tuple """
axmin,axmax = axlim
axrng = axmax - axmin
new_min = axmin - 0.1 * axrng
new_max = axmax + 0.1 * axrng
return new_min,new_max
...
ax.set_ylim( larger_axlim( ax.get_ylim() ) )
...
Documentation: get_ylim()