You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1701+g250c33e83
Fork me on GitHub

Related Topics

Dropped spinesΒΆ

Demo of spines offset from the axes (a.k.a. "dropped spines").

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility

fig, ax = plt.subplots()

image = np.random.uniform(size=(10, 10))
ax.imshow(image,, interpolation='nearest')
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
# Only show ticks on the left and bottom spines

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery