8000 Merge pull request #4097 from lichri12/patch-1 · matplotlib/matplotlib@08b8adb · GitHub
[go: up one dir, main page]

Skip to content

Commit 08b8adb

Browse files
committed
Merge pull request #4097 from lichri12/patch-1
BUG : Move offset text with tick labels closes #4043
2 parents bbdfeaa + c17dda6 commit 08b8adb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/matplotlib/axis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,9 +2114,11 @@ def set_ticks_position(self, position):
21142114
if position == 'right':
21152115
self.set_tick_params(which='both', right=True, labelright=True,
21162116
left=False, labelleft=False)
2117+
self.set_offset_position(position)
21172118
elif position == 'left':
21182119
self.set_tick_params(which='both', right=False, labelright=False,
21192120
left=True, labelleft=True)
2121+
self.set_offset_position(position)
21202122
elif position == 'both':
21212123
self.set_tick_params(which='both', right=True,
21222124
left=True)

lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,14 @@ def test_color_None():
35083508
def test_numerical_hist_label():
35093509
fig, ax = plt.subplots()
35103510
ax.hist([range(15)] * 5, label=range(5))
3511+
3512+
@cleanup
3513+
def test_move_offsetlabel():
3514+
data = np.random.random(10) * 1e-22
3515+
fig, ax = plt.subplots()
3516+
ax.plot(data)
3517+
ax.yaxis.tick_right()
3518+
assert_equal((1, 0.5), ax.yaxis.offsetText.get_position())
35113519

35123520
if __name__ == '__main__':
35133521
import nose

0 commit comments

Comments
 (0)
0