掉落的spines
从轴上偏移的spines的演示(a.k.a。“掉落的spines”)。

import numpy as npimport matplotlib.pyplot as plt# Fixing random state for reproducibilitynp.random.seed(19680801)fig, ax = plt.subplots()image = np.random.uniform(size=(10, 10))ax.imshow(image, cmap=plt.cm.gray, interpolation='nearest')ax.set_title('dropped spines')# Move left and bottom spines outward by 10 pointsax.spines['left'].set_position(('outward', 10))ax.spines['bottom'].set_position(('outward', 10))# Hide the right and top spinesax.spines['right'].set_visible(False)ax.spines['top'].set_visible(False)# Only show ticks on the left and bottom spinesax.yaxis.set_ticks_position('left')ax.xaxis.set_ticks_position('bottom')plt.show()
