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

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

.. _sphx_glr_gallery_axisartist_axis_direction.py:


==============
Axis Direction
==============

.. GENERATED FROM PYTHON SOURCE LINES 6-69



.. image-sg:: /gallery/axisartist/images/sphx_glr_axis_direction_001.png
   :alt: label direction=$+$, label direction=$-$, ticklabel direction=$+$, ticklabel direction=$-$
   :srcset: /gallery/axisartist/images/sphx_glr_axis_direction_001.png, /gallery/axisartist/images/sphx_glr_axis_direction_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt

    import mpl_toolkits.axisartist as axisartist


    def setup_axes(fig, pos):
        ax = fig.add_subplot(pos, axes_class=axisartist.Axes)

        ax.set_ylim(-0.1, 1.5)
        ax.set_yticks([0, 1])

        ax.axis[:].set_visible(False)

        ax.axis["x"] = ax.new_floating_axis(1, 0.5)
        ax.axis["x"].set_axisline_style("->", size=1.5)

        return ax


    plt.rcParams.update({
        "axes.titlesize": "medium",
        "axes.titley": 1.1,
    })

    fig = plt.figure(figsize=(10, 4))
    fig.subplots_adjust(bottom=0.1, top=0.9, left=0.05, right=0.95)

    ax1 = setup_axes(fig, 251)
    ax1.axis["x"].set_axis_direction("left")

    ax2 = setup_axes(fig, 252)
    ax2.axis["x"].label.set_text("Label")
    ax2.axis["x"].toggle(ticklabels=False)
    ax2.axis["x"].set_axislabel_direction("+")
    ax2.set_title("label direction=$+$")

    ax3 = setup_axes(fig, 253)
    ax3.axis["x"].label.set_text("Label")
    ax3.axis["x"].toggle(ticklabels=False)
    ax3.axis["x"].set_axislabel_direction("-")
    ax3.set_title("label direction=$-$")

    ax4 = setup_axes(fig, 254)
    ax4.axis["x"].set_ticklabel_direction("+")
    ax4.set_title("ticklabel direction=$+$")

    ax5 = setup_axes(fig, 255)
    ax5.axis["x"].set_ticklabel_direction("-")
    ax5.set_title("ticklabel direction=$-$")

    ax7 = setup_axes(fig, 257)
    ax7.axis["x"].label.set_text("rotation=10")
    ax7.axis["x"].label.set_rotation(10)
    ax7.axis["x"].toggle(ticklabels=False)

    ax8 = setup_axes(fig, 258)
    ax8.axis["x"].set_axislabel_direction("-")
    ax8.axis["x"].label.set_text("rotation=10")
    ax8.axis["x"].label.set_rotation(10)
    ax8.axis["x"].toggle(ticklabels=False)

    plt.show()


.. _sphx_glr_download_gallery_axisartist_axis_direction.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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