Skip to content

Commit

Permalink
Merge pull request #6445 from benjamincongdon/fix-label-color
Browse files Browse the repository at this point in the history
Offset text colored by labelcolor param
  • Loading branch information
tacaswell committed May 22, 2016
1 parent 58105d7 commit 3df2df1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/users/whats_new/offset_label_color.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Axis offset label now responds to `labelcolor`
----------------------------------------------

Axis offset labels are now colored the same as axis tick markers when `labelcolor` is altered.
2 changes: 2 additions & 0 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,8 @@ def set_tick_params(self, which='major', reset=False, **kw):
if which == 'minor' or which == 'both':
for tick in self.minorTicks:
tick._apply_params(**self._minor_tick_kw)
if 'labelcolor' in kwtrans:
self.offsetText.set_color(kwtrans['labelcolor'])
self.stale = True

@staticmethod
Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4475,6 +4475,16 @@ def test_axisbelow():
ax.set_axisbelow(setting)


@cleanup
def test_offset_label_color():
# Tests issue 6440
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot([1.01e9, 1.02e9, 1.03e9])
ax.yaxis.set_tick_params(labelcolor='red')
assert ax.yaxis.get_offset_text().get_color() == 'red'


@cleanup
def test_large_offset():
fig, ax = plt.subplots()
Expand Down

0 comments on commit 3df2df1

Please sign in to comment.