
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/axisartist/simple_axisline.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_axisartist_simple_axisline.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_axisartist_simple_axisline.py:


===============
Simple Axisline
===============

.. GENERATED FROM PYTHON SOURCE LINES 7-37



.. image-sg:: /gallery/axisartist/images/sphx_glr_simple_axisline_001.png
   :alt: simple axisline
   :srcset: /gallery/axisartist/images/sphx_glr_simple_axisline_001.png, /gallery/axisartist/images/sphx_glr_simple_axisline_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt

    from mpl_toolkits.axisartist.axislines import AxesZero

    fig = plt.figure()
    fig.subplots_adjust(right=0.85)
    ax = fig.add_subplot(axes_class=AxesZero)

    # make right and top axis invisible
    ax.axis["right"].set_visible(False)
    ax.axis["top"].set_visible(False)

    # make xzero axis (horizontal axis line through y=0) visible.
    ax.axis["xzero"].set_visible(True)
    ax.axis["xzero"].label.set_text("Axis Zero")

    ax.set_ylim(-2, 4)
    ax.set_xlabel("Label X")
    ax.set_ylabel("Label Y")
    # Or:
    # ax.axis["bottom"].label.set_text("Label X")
    # ax.axis["left"].label.set_text("Label Y")

    # make new (right-side) yaxis, but with some offset
    ax.axis["right2"] = ax.new_fixed_axis(loc="right", offset=(20, 0))
    ax.axis["right2"].label.set_text("Label Y2")

    ax.plot([-2, 3, 2])
    plt.show()


.. _sphx_glr_download_gallery_axisartist_simple_axisline.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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