8000 Simplify SecondaryAxis.set_color. · matplotlib/matplotlib@7ee702a · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ee702a

Browse files
committed
Simplify SecondaryAxis.set_color.
The "orthogonal" axis is invisible, so we can just set the color of all ticks, spines, and labels, regardless of orientation.
1 parent b53418e commit 7ee702a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -372,21 +372,16 @@ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
372372
def set_color(self, color):
373373
"""
374374
Change the color of the secondary axes and all decorators
375+
375376
Parameters
376377
----------
377378
color : Matplotlib color
378379
"""
379-
380-
if self._orientation == 'x':
381-
self.tick_params(axis='x', colors=color)
382-
self.spines['bottom'].set_color(color)
383-
self.spines['top'].set_color(color)
384-
self.xaxis.label.set_color(color)
385-
else:
386-
self.tick_params(axis='y', colors=color)
387-
self.spines['left'].set_color(color)
388-
self.spines['right'].set_color(color)
389-
self.yaxis.label.set_color(color)
380+
self.tick_params(colors=color)
381+
for spine in self.spines.values():
382+
spine.set_color(color)
383+
for axis in self._get_axis_list():
384+
axis.label.set_color(color)
390385

391386

392387
_secax_docstring = '''

0 commit comments

Comments
 (0)
0