diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index dba6fd15f686..71312d2da4a2 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -2140,6 +2140,7 @@ def set_ticks_position(self, position): elif position == 'default': self.set_tick_params(which='both', right=True, labelright=False, left=True, labelleft=True) + self.set_offset_position('left') else: raise ValueError("invalid position: %s" % position) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 22607650182f..387f41cfef09 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -3557,6 +3557,24 @@ def test_move_offsetlabel(): ax.plot(data) ax.yaxis.tick_right() assert_equal((1, 0.5), ax.yaxis.offsetText.get_position()) + +@cleanup +def test_move_offsetlabel_default(): + data = np.random.random(10) * 1e-22 + fig, ax = plt.subplots() + ax.plot(data) + ax.yaxis.tick_right() + ax.yaxis.set_ticks_position('default') + assert_equal((0, 0.5), ax.yaxis.offsetText.get_position()) + +@cleanup +def test_move_offsetlabel_left(): + data = np.random.random(10) * 1e-22 + fig, ax = plt.subplots() + ax.plot(data) + ax.yaxis.tick_right() + ax.yaxis.tick_left() + assert_equal((0, 0.5), ax.yaxis.offsetText.get_position()) if __name__ == '__main__': import nose