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

.. only:: html

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

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

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

.. _sphx_glr_gallery_pyplots_fig_axes_labels_simple.py:


==================
Simple axes labels
==================

Label the axes of a plot.

.. GENERATED FROM PYTHON SOURCE LINES 8-30

.. code-block:: default

    import numpy as np
    import matplotlib.pyplot as plt

    fig = plt.figure()
    fig.subplots_adjust(top=0.8)
    ax1 = fig.add_subplot(211)
    ax1.set_ylabel('volts')
    ax1.set_title('a sine wave')

    t = np.arange(0.0, 1.0, 0.01)
    s = np.sin(2 * np.pi * t)
    line, = ax1.plot(t, s, lw=2)

    # Fixing random state for reproducibility
    np.random.seed(19680801)

    ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
    n, bins, patches = ax2.hist(np.random.randn(1000), 50)
    ax2.set_xlabel('time (s)')

    plt.show()




.. image:: /gallery/pyplots/images/sphx_glr_fig_axes_labels_simple_001.png
    :alt: a sine wave
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 31-38

------------

References
""""""""""

The use of the following functions, methods, classes and modules is shown
in this example:

.. GENERATED FROM PYTHON SOURCE LINES 39-47

.. code-block:: default


    import matplotlib
    matplotlib.axes.Axes.set_xlabel
    matplotlib.axes.Axes.set_ylabel
    matplotlib.axes.Axes.set_title
    matplotlib.axes.Axes.plot
    matplotlib.axes.Axes.hist
    matplotlib.figure.Figure.add_axes




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

 Out:

 .. code-block:: none


    <function Figure.add_axes at 0x7f73be8905e0>




.. _sphx_glr_download_gallery_pyplots_fig_axes_labels_simple.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: fig_axes_labels_simple.py <fig_axes_labels_simple.py>`



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

     :download:`Download Jupyter notebook: fig_axes_labels_simple.ipynb <fig_axes_labels_simple.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>`_
