diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index b9499b789811..e420d87ef57d 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -2114,9 +2114,11 @@ def set_ticks_position(self, position): if position == 'right': self.set_tick_params(which='both', right=True, labelright=True, left=False, labelleft=False) + self.set_offset_position(position) elif position == 'left': self.set_tick_params(which='both', right=False, labelright=False, left=True, labelleft=True) + self.set_offset_position(position) elif position == 'both': self.set_tick_params(which='both', right=True, left=True) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 74e8c31cf809..cb2ac8e8cd66 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -3508,6 +3508,14 @@ def test_color_None(): def test_numerical_hist_label(): fig, ax = plt.subplots() ax.hist([range(15)] * 5, label=range(5)) + +@cleanup +def test_move_offsetlabel(): + data = np.random.random(10) * 1e-22 + fig, ax = plt.subplots() + ax.plot(data) + ax.yaxis.tick_right() + assert_equal((1, 0.5), ax.yaxis.offsetText.get_position()) if __name__ == '__main__': import nose