You are reading an old version of the documentation (v1.4.0). For the latest version see

Previous topic

ticks_and_spines example code:

Next topic

ticks_and_spines example code:

This Page

ticks_and_spines example code: spines_demo_dropped.pyΒΆ

(Source code, png, hires.png, pdf)

Demo of spines offset from the axes (a.k.a. "dropped spines").
import numpy as np
import matplotlib.pyplot as plt

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: python, matplotlib, pylab, example, codex (see Search examples)