

.. _sphx_glr_gallery_pyplots_whats_new_99_axes_grid.py:


========================
Whats New 0.99 Axes Grid
========================





.. image:: /gallery/pyplots/images/sphx_glr_whats_new_99_axes_grid_001.png
    :align: center





.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes

    def get_demo_image():
        # prepare image
        delta = 0.5

        extent = (-3,4,-4,3)
        x = np.arange(-3.0, 4.001, delta)
        y = np.arange(-4.0, 3.001, delta)
        X, Y = np.meshgrid(x, y)
        import matplotlib.mlab as mlab
        Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
        Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
        Z = (Z1 - Z2) * 10

        return Z, extent



    def get_rgb():
        Z, extent = get_demo_image()

        Z[Z<0] = 0.
        Z = Z/Z.max()

        R = Z[:13,:13]
        G = Z[2:,2:]
        B = Z[:13,2:]

        return R, G, B


    fig = plt.figure(1)
    ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])

    r, g, b = get_rgb()
    kwargs = dict(origin="lower", interpolation="nearest")
    ax.imshow_rgb(r, g, b, **kwargs)

    ax.RGB.set_xlim(0., 9.5)
    ax.RGB.set_ylim(0.9, 10.6)


    plt.draw()
    plt.show()

**Total running time of the script:** ( 0 minutes  0.250 seconds)



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

     :download:`Download Python source code: whats_new_99_axes_grid.py <whats_new_99_axes_grid.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: whats_new_99_axes_grid.ipynb <whats_new_99_axes_grid.ipynb>`

.. rst-class:: sphx-glr-signature

    `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
