.. 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 .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_axisartist_demo_ticklabel_direction.py: ======================== Demo Ticklabel Direction ======================== .. GENERATED FROM PYTHON SOURCE LINES 7-48 .. image:: /gallery/axisartist/images/sphx_glr_demo_ticklabel_direction_001.png :alt: demo ticklabel direction :class: sphx-glr-single-img .. code-block:: default 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(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 :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_ticklabel_direction.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_ticklabel_direction.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot `Gallery generated by Sphinx-Gallery `_