

.. _sphx_glr_gallery_userdemo_demo_ticklabel_direction.py:


========================
Demo Ticklabel Direction
========================





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





.. code-block:: python


    import matplotlib.pyplot as plt
    import mpl_toolkits.axisartist.axislines as axislines


    def setup_axes(fig, rect):
        ax = axislines.Subplot(fig, rect)
        fig.add_subplot(ax)

        ax.set_yticks([0.2, 0.8])
        ax.set_xticks([0.2, 0.8])

        return ax


    fig = plt.figure(1, 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()

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



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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