
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/axes_grid1/simple_colorbar.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_axes_grid1_simple_colorbar.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_axes_grid1_simple_colorbar.py:


===============
Simple Colorbar
===============

.. GENERATED FROM PYTHON SOURCE LINES 7-23

.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    from mpl_toolkits.axes_grid1 import make_axes_locatable

    ax = plt.subplot()
    im = ax.imshow(np.arange(100).reshape((10, 10)))

    # create an Axes on the right side of ax. The width of cax will be 5%
    # of ax and the padding between cax and ax will be fixed at 0.05 inch.
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.05)

    plt.colorbar(im, cax=cax)

    plt.show()


.. _sphx_glr_download_gallery_axes_grid1_simple_colorbar.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

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

    .. container:: sphx-glr-download sphx-glr-download-python

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: simple_colorbar.zip <simple_colorbar.zip>`


.. only:: html

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

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