@image_comparison(baseline_images=['inset_locator'], style='default', extensions=['png'], remove_text=True)
def test_inset_locator():

    def get_demo_image():
        from matplotlib.cbook import get_sample_data
        import numpy as np
        f = get_sample_data('axes_grid/bivariate_normal.npy', asfileobj=False)
        z = np.load(f)
        return (z, ((- 3), 4, (- 4), 3))
    (fig, ax) = plt.subplots(figsize=[5, 4])
    (Z, extent) = get_demo_image()
    Z2 = np.zeros([150, 150], dtype='d')
    (ny, nx) = Z.shape
    Z2[30:(30 + ny), 30:(30 + nx)] = Z
    ax.imshow(Z2, extent=extent, interpolation='nearest', origin='lower')
    axins = zoomed_inset_axes(ax, 6, loc=1)
    axins.imshow(Z2, extent=extent, interpolation='nearest', origin='lower')
    axins.yaxis.get_major_locator().set_params(nbins=7)
    axins.xaxis.get_major_locator().set_params(nbins=7)
    (x1, x2, y1, y2) = ((- 1.5), (- 0.9), (- 2.5), (- 1.9))
    axins.set_xlim(x1, x2)
    axins.set_ylim(y1, y2)
    plt.xticks(visible=False)
    plt.yticks(visible=False)
    mark_inset(ax, axins, loc1=2, loc2=4, fc='none', ec='0.5')
    asb = AnchoredSizeBar(ax.transData, 0.5, '0.5', loc=8, pad=0.1, borderpad=0.5, sep=5, frameon=False)
    ax.add_artist(asb)
@image_comparison(baseline_images=['inset_locator'], style='default', extensions=['png'], remove_text=True)
def test_inset_locator():

    def get_demo_image():
        from matplotlib.cbook import get_sample_data
        import numpy as np
        f = get_sample_data('axes_grid/bivariate_normal.npy', asfileobj=False)
        z = np.load(f)
        return (z, ((- 3), 4, (- 4), 3))
    (fig, ax) = plt.subplots(figsize=[5, 4])
    (Z, extent) = get_demo_image()
    Z2 = np.zeros([150, 150], dtype='d')
    (ny, nx) = Z.shape
    Z2[30:(30 + ny), 30:(30 + nx)] = Z
    ax.imshow(Z2, extent=extent, interpolation='nearest', origin='lower')
    axins = zoomed_inset_axes(ax, 6, loc=1)
    axins.imshow(Z2, extent=extent, interpolation='nearest', origin='lower')
    axins.yaxis.get_major_locator().set_params(nbins=7)
    axins.xaxis.get_major_locator().set_params(nbins=7)
    (x1, x2, y1, y2) = ((- 1.5), (- 0.9), (- 2.5), (- 1.9))
    axins.set_xlim(x1, x2)
    axins.set_ylim(y1, y2)
    plt.xticks(visible=False)
    plt.yticks(visible=False)
    mark_inset(ax, axins, loc1=2, loc2=4, fc='none', ec='0.5')
    asb = AnchoredSizeBar(ax.transData, 0.5, '0.5', loc=8, pad=0.1, borderpad=0.5, sep=5, frameon=False)
    ax.add_artist(asb)