Closed
Description
The following code plots some random data and moves the spines outward. It works just as expected if it leaves the automatic tick labels alone, but if it disables them the axis labels do not move with the spines. This is on the v1.4.x branch.
import numpy as np
from matplotlib import pyplot as plt
for ticks in True, False:
fig, ax = plt.subplots(figsize=(10,8), dpi=100)
plt.subplots_adjust(left=0.3, bottom=0.3)
data = np.random.uniform(size=100)
ax.plot(data)
ax.yaxis.set_ticks_position('left')
ax.spines['left'].set_position(('outward', 30))
ax.spines['right'].set_visible(False)
ax.set_ylabel('random numbers')
ax.xaxis.set_ticks_position('bottom')
ax.spines['bottom'].set_position(('outward', 30))
ax.spines['top'].set_visible(False)
ax.set_xlabel('sequence')
if not ticks:
ax.xaxis.set_ticks([])
ax.yaxis.set_ticks([])
plt.savefig('ticks-%s.png' % ticks)
The output with ticks enabled:
and with ticks disabled: