Skip to content

Commit

Permalink
Merge pull request #4097 from lichri12/patch-1
Browse files Browse the repository at this point in the history
BUG : Move offset text with tick labels

closes #4043
  • Loading branch information
tacaswell committed Feb 16, 2015
2 parents bbdfeaa + c17dda6 commit 08b8adb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/matplotlib/axis.py
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Expand Up @@ -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
Expand Down

0 comments on commit 08b8adb

Please sign in to comment.