Closed
Description
When I have just the right set of commands, the tick label padding on the first y-axis changes when I add a second y-axis. Here are my minimal working examples.
This set of commands
import matplotlib as mpl
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = plt.subplot()
ax1.plot(range(2),range(2))
ax1.yaxis.set_tick_params(which = 'major', direction = 'out', \
labelsize = mpl.rcParams['font.size'], size = mpl.rcParams['ytick.major.size'])
fig.savefig('No_Issue1.png')
produces a figure that looks fine to me:
This set of commands,
fig = plt.figure()
ax1 = plt.subplot()
ax1.plot(range(2),range(2))
ax2 = ax1.twinx()
fig.savefig('No_Issue2.png')
also produces a figure that looks fine, even after adding a second y-axis:
This set of commands
fig = plt.figure()
ax1 = plt.subplot()
ax1.plot(range(2),range(2))
ax1.yaxis.set_tick_params(which = 'major', direction = 'out', \
labelsize = mpl.rcParams['font.size'], size = mpl.rcParams['ytick.major.size'])
ax2 = ax1.twinx()
fig.savefig('Issue.png')
however, messes with the tick label padding on the first y-axis:
Apparently, the following commands
ax1.yaxis.set_tick_params(which = 'major', direction = 'out', \
labelsize = mpl.rcParams['font.size'], size = mpl.rcParams['ytick.major.size'])
ax2 = ax1.twinx()
do not play nice together.
In case it matters, I am on matplotlib 1.4.0