Provides padding on sides of frame equal to pad fraction of plot

def _pad_plot_frame(ax, pad=0.01):
    """
    Provides padding on sides of frame equal to pad fraction of plot
    """

    xmin, xmax = ax.get_xlim()
    ymin, ymax = ax.get_ylim()
    xr = xmax - xmin
    yr = ymax - ymin

    ax.set_xlim(xmin - xr*pad, xmax + xr*pad)
    ax.set_ylim(ymin - yr*pad, ymax + yr*pad)

    return ax