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

.. only:: html

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

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

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

.. _sphx_glr_gallery_pyplots_axline.py:


==============
Infinite lines
==============

`~.axes.Axes.axvline` and `~.axes.Axes.axhline` draw infinite vertical /
horizontal lines, at given *x* / *y* positions. They are usually used to mark
special data values, e.g. in this example the center and limit values of the
sigmoid function.

`~.axes.Axes.axline` draws infinite straight lines in arbitrary directions.

.. GENERATED FROM PYTHON SOURCE LINES 13-30

.. code-block:: default

    import numpy as np
    import matplotlib.pyplot as plt

    t = np.linspace(-10, 10, 100)
    sig = 1 / (1 + np.exp(-t))

    plt.axhline(y=0, color="black", linestyle="--")
    plt.axhline(y=0.5, color="black", linestyle=":")
    plt.axhline(y=1.0, color="black", linestyle="--")
    plt.axvline(color="grey")
    plt.axline((0, 0.5), slope=0.25, color="black", linestyle=(0, (5, 5)))
    plt.plot(t, sig, linewidth=2, label=r"$\sigma(t) = \frac{1}{1 + e^{-t}}$")
    plt.xlim(-10, 10)
    plt.xlabel("t")
    plt.legend(fontsize=14)
    plt.show()




.. image:: /gallery/pyplots/images/sphx_glr_axline_001.png
    :alt: axline
    :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.pyplot.axhline
    matplotlib.pyplot.axvline
    matplotlib.pyplot.axline
    matplotlib.axes.Axes.axhline
    matplotlib.axes.Axes.axvline
    matplotlib.axes.Axes.axline




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

 Out:

 .. code-block:: none


    <function Axes.axline at 0x7f73be8ef820>




.. _sphx_glr_download_gallery_pyplots_axline.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: axline.py <axline.py>`



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

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