

.. _sphx_glr_gallery_axisartist_demo_axisline_style.py:


================
Axis line styles
================

This example shows some configurations for axis style.




.. image:: /gallery/axisartist/images/sphx_glr_demo_axisline_style_001.png
    :align: center





.. code-block:: python


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

    if 1:
        fig = plt.figure(1)
        ax = SubplotZero(fig, 111)
        fig.add_subplot(ax)

        for direction in ["xzero", "yzero"]:
            # adds arrows at the ends of each axis
            ax.axis[direction].set_axisline_style("-|>")

            # adds X and Y-axis from the origin
            ax.axis[direction].set_visible(True)

        for direction in ["left", "right", "bottom", "top"]:
            # hides borders
            ax.axis[direction].set_visible(False)

        x = np.linspace(-0.5, 1., 100)
        ax.plot(x, np.sin(x*np.pi))

        plt.show()

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



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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

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

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