

.. _sphx_glr_gallery_userdemo_simple_axisline2.py:


================
Simple Axisline2
================





.. image:: /gallery/userdemo/images/sphx_glr_simple_axisline2_001.png
    :align: center





.. code-block:: python

    import matplotlib.pyplot as plt
    from mpl_toolkits.axisartist.axislines import SubplotZero
    import numpy as np

    fig = plt.figure(1, (4, 3))

    # a subplot with two additional axis, "xzero" and "yzero". "xzero" is
    # y=0 line, and "yzero" is x=0 line.
    ax = SubplotZero(fig, 1, 1, 1)
    fig.add_subplot(ax)

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

    # make other axis (bottom, top, right) invisible.
    for n in ["bottom", "top", "right"]:
        ax.axis[n].set_visible(False)

    xx = np.arange(0, 2*np.pi, 0.01)
    ax.plot(xx, np.sin(xx))

    plt.show()

**Total running time of the script:** ( 0 minutes  0.135 seconds)



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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

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

    `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
