

.. _sphx_glr_gallery_axes_grid1_simple_axesgrid.py:


===============
Simple Axesgrid
===============





.. image:: /gallery/axes_grid1/images/sphx_glr_simple_axesgrid_001.png
    :align: center





.. code-block:: python

    import matplotlib.pyplot as plt
    from mpl_toolkits.axes_grid1 import ImageGrid
    import numpy as np

    im = np.arange(100).reshape((10, 10))

    fig = plt.figure(1, (4., 4.))
    grid = ImageGrid(fig, 111,  # similar to subplot(111)
                     nrows_ncols=(2, 2),  # creates 2x2 grid of axes
                     axes_pad=0.1,  # pad between axes in inch.
                     )

    for i in range(4):
        grid[i].imshow(im)  # The AxesGrid object work as a list of axes.

    plt.show()

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



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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