Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3df2df1

Browse filesBrowse files
committed
Merge pull request #6445 from benjamincongdon/fix-label-color
Offset text colored by labelcolor param
1 parent 58105d7 commit 3df2df1
Copy full SHA for 3df2df1

File tree

Expand file treeCollapse file tree

3 files changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+16
-0
lines changed
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Axis offset label now responds to `labelcolor`
2+
----------------------------------------------
3+
4+
Axis offset labels are now colored the same as axis tick markers when `labelcolor` is altered.

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ def set_tick_params(self, which='major', reset=False, **kw):
796796
if which == 'minor' or which == 'both':
797797
for tick in self.minorTicks:
798798
tick._apply_params(**self._minor_tick_kw)
799+
if 'labelcolor' in kwtrans:
800+
self.offsetText.set_color(kwtrans['labelcolor'])
799801
self.stale = True
800802

801803
@staticmethod

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4475,6 +4475,16 @@ def test_axisbelow():
44754475
ax.set_axisbelow(setting)
44764476

44774477

4478+
@cleanup
4479+
def test_offset_label_color():
4480+
# Tests issue 6440
4481+
fig = plt.figure()
4482+
ax = fig.add_subplot(1, 1, 1)
4483+
ax.plot([1.01e9, 1.02e9, 1.03e9])
4484+
ax.yaxis.set_tick_params(labelcolor='red')
4485+
assert ax.yaxis.get_offset_text().get_color() == 'red'
4486+
4487+
44784488
@cleanup
44794489
def test_large_offset():
44804490
fig, ax = plt.subplots()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.