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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_axes_grid1_demo_fixed_size_axes.py>`
        to download the full example code

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

.. _sphx_glr_gallery_axes_grid1_demo_fixed_size_axes.py:


====================
Demo Fixed Size Axes
====================

.. GENERATED FROM PYTHON SOURCE LINES 6-11

.. code-block:: default


    import matplotlib.pyplot as plt

    from mpl_toolkits.axes_grid1 import Divider, Size








.. GENERATED FROM PYTHON SOURCE LINES 12-29

.. code-block:: default



    fig = plt.figure(figsize=(6, 6))

    # The first items are for padding and the second items are for the axes.
    # sizes are in inch.
    h = [Size.Fixed(1.0), Size.Fixed(4.5)]
    v = [Size.Fixed(0.7), Size.Fixed(5.)]

    divider = Divider(fig, (0, 0, 1, 1), h, v, aspect=False)
    # The width and height of the rectangle are ignored.

    ax = fig.add_axes(divider.get_position(),
                      axes_locator=divider.new_locator(nx=1, ny=1))

    ax.plot([1, 2, 3])




.. image:: /gallery/axes_grid1/images/sphx_glr_demo_fixed_size_axes_001.png
    :alt: demo fixed size axes
    :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    [<matplotlib.lines.Line2D object at 0x7f73b52d79d0>]



.. GENERATED FROM PYTHON SOURCE LINES 30-48

.. code-block:: default



    fig = plt.figure(figsize=(6, 6))

    # The first & third items are for padding and the second items are for the
    # axes. Sizes are in inches.
    h = [Size.Fixed(1.0), Size.Scaled(1.), Size.Fixed(.2)]
    v = [Size.Fixed(0.7), Size.Scaled(1.), Size.Fixed(.5)]

    divider = Divider(fig, (0, 0, 1, 1), h, v, aspect=False)
    # The width and height of the rectangle are ignored.

    ax = fig.add_axes(divider.get_position(),
                      axes_locator=divider.new_locator(nx=1, ny=1))

    ax.plot([1, 2, 3])

    plt.show()



.. image:: /gallery/axes_grid1/images/sphx_glr_demo_fixed_size_axes_002.png
    :alt: demo fixed size axes
    :class: sphx-glr-single-img






.. _sphx_glr_download_gallery_axes_grid1_demo_fixed_size_axes.py:


.. only :: html

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



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

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



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

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
