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

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

.. _sphx_glr_gallery_axisartist_demo_ticklabel_direction.py:


===================
Ticklabel direction
===================

.. GENERATED FROM PYTHON SOURCE LINES 7-46



.. image-sg:: /gallery/axisartist/images/sphx_glr_demo_ticklabel_direction_001.png
   :alt: demo ticklabel direction
   :srcset: /gallery/axisartist/images/sphx_glr_demo_ticklabel_direction_001.png, /gallery/axisartist/images/sphx_glr_demo_ticklabel_direction_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt

    import mpl_toolkits.axisartist.axislines as axislines


    def setup_axes(fig, pos):
        ax = fig.add_subplot(pos, axes_class=axislines.Axes)
        ax.set_yticks([0.2, 0.8])
        ax.set_xticks([0.2, 0.8])
        return ax


    fig = plt.figure(figsize=(6, 3))
    fig.subplots_adjust(bottom=0.2)

    ax = setup_axes(fig, 131)
    for axis in ax.axis.values():
        axis.major_ticks.set_tick_out(True)
    # or you can simply do "ax.axis[:].major_ticks.set_tick_out(True)"

    ax = setup_axes(fig, 132)
    ax.axis["left"].set_axis_direction("right")
    ax.axis["bottom"].set_axis_direction("top")
    ax.axis["right"].set_axis_direction("left")
    ax.axis["top"].set_axis_direction("bottom")

    ax = setup_axes(fig, 133)
    ax.axis["left"].set_axis_direction("right")
    ax.axis[:].major_ticks.set_tick_out(True)

    ax.axis["left"].label.set_text("Long Label Left")
    ax.axis["bottom"].label.set_text("Label Bottom")
    ax.axis["right"].label.set_text("Long Label Right")
    ax.axis["right"].label.set_visible(True)
    ax.axis["left"].label.set_pad(0)
    ax.axis["bottom"].label.set_pad(10)

    plt.show()


.. _sphx_glr_download_gallery_axisartist_demo_ticklabel_direction.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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