.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/ticks_and_spines/spines_dropped.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_ticks_and_spines_spines_dropped.py: ============== Dropped spines ============== Demo of spines offset from the axes (a.k.a. "dropped spines"). .. GENERATED FROM PYTHON SOURCE LINES 8-31 .. image:: /gallery/ticks_and_spines/images/sphx_glr_spines_dropped_001.png :alt: dropped spines :class: sphx-glr-single-img .. code-block:: default import numpy as np import matplotlib.pyplot as plt # Fixing random state for reproducibility np.random.seed(19680801) fig, ax = plt.subplots() image = np.random.uniform(size=(10, 10)) ax.imshow(image, cmap=plt.cm.gray) ax.set_title('dropped spines') # Move left and bottom spines outward by 10 points ax.spines.left.set_position(('outward', 10)) ax.spines.bottom.set_position(('outward', 10)) # Hide the right and top spines ax.spines.right.set_visible(False) ax.spines.top.set_visible(False) # Only show ticks on the left and bottom spines ax.yaxis.set_ticks_position('left') ax.xaxis.set_ticks_position('bottom') plt.show() .. _sphx_glr_download_gallery_ticks_and_spines_spines_dropped.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: spines_dropped.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: spines_dropped.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot `Gallery generated by Sphinx-Gallery `_