.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/introductory/axline.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_introductory_axline.py: ====== AxLine ====== An infinitely long straight line can be added using ``ax.axline`` in a similar way as Matplotlib. This may be helpful, e.g., for adding an isoproportion line. .. note:: Available with ``matplotlib>=3.3`` and ``mpltern>=0.4.0`` Unlike Matplotlib, ``slope`` is the displacement from the first argument and must be of length 3, whose sum should be zero. The sum of the first argument and ``slope`` is automatically scaled by ``ternary_sum``. With ``matplotlib>=3.4``, a keyword argument ``transform`` can be given. Particularly when `ax.transTernaryAxes` is given, a line fixed to the triangle can be added by giving the first and the second arguments in the barycentric coordinates. .. GENERATED FROM PYTHON SOURCE LINES 22-45 .. image-sg:: /gallery/introductory/images/sphx_glr_axline_001.svg :alt: axline :srcset: /gallery/introductory/images/sphx_glr_axline_001.svg :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import mpltern ax = plt.subplot(projection="ternary") ax.axline( [1.0, 0.0, 0.0], [0.0, 0.8, 0.2], color="C0", ) ax.axline( [1.0, 0.0, 0.0], slope=[-0.2, 0.1, 0.1], color="C1", ) ax.axline( [1.0, 0.0, 0.0], [0.0, 0.2, 0.8], color="C2", transform=ax.transTernaryAxes, ) plt.show() .. _sphx_glr_download_gallery_introductory_axline.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: axline.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: axline.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_