File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -2259,7 +2259,9 @@ def _init(self):
22592259 transform = mtransforms .blended_transform_factory (
22602260 self .axes .transAxes , mtransforms .IdentityTransform ()),
22612261 fontsize = mpl .rcParams ['xtick.labelsize' ],
2262- color = mpl .rcParams ['xtick.color' ],
2262+ color = mpl .rcParams ['xtick.color' ] if
2263+ mpl .rcParams ['xtick.labelcolor' ] == 'inherit' else
2264+ mpl .rcParams ['xtick.labelcolor' ],
22632265 )
22642266 self .offset_text_position = 'bottom'
22652267
@@ -2519,7 +2521,9 @@ def _init(self):
25192521 transform = mtransforms .blended_transform_factory (
25202522 self .axes .transAxes , mtransforms .IdentityTransform ()),
25212523 fontsize = mpl .rcParams ['ytick.labelsize' ],
2522- color = mpl .rcParams ['ytick.color' ],
2524+ color = mpl .rcParams ['ytick.color' ] if
2525+ mpl .rcParams ['ytick.labelcolor' ] == 'inherit' else
2526+ mpl .rcParams ['ytick.labelcolor' ],
25232527 )
25242528 self .offset_text_position = 'left'
25252529
Original file line number Diff line number Diff line change @@ -7811,6 +7811,36 @@ def test_ytickcolor_is_not_yticklabelcolor():
78117811 assert tick .label1 .get_color () == 'blue'
78127812
78137813
7814+ def test_xticklabelcolor_if_not_xtickcolor ():
7815+ plt .rcParams ['xtick.labelcolor' ] = 'blue'
7816+ ax = plt .axes ()
7817+ ticks = ax .xaxis .get_major_ticks ()
7818+ for tick in ticks :
7819+ assert tick .label1 .get_color () == 'blue'
7820+
7821+ plt .rcParams ['xtick.color' ] = 'yellow'
7822+ plt .rcParams ['xtick.labelcolor' ] = 'inherit'
7823+ ax = plt .axes ()
7824+ ticks = ax .xaxis .get_major_ticks ()
7825+ for tick in ticks :
7826+ assert tick .label1 .get_color () == 'yellow'
7827+
7828+
7829+ def test_yticklabelcolor_if_not_ytickcolor ():
7830+ plt .rcParams ['ytick.labelcolor' ] = 'green'
7831+ ax = plt .axes ()
7832+ ticks = ax .yaxis .get_major_ticks ()
7833+ for tick in ticks :
7834+ assert tick .label1 .get_color () == 'green'
7835+
7836+ plt .rcParams ['ytick.color' ] = 'red'
7837+ plt .rcParams ['ytick.labelcolor' ] = 'inherit'
7838+ ax = plt .axes ()
7839+ ticks = ax .yaxis .get_major_ticks ()
7840+ for tick in ticks :
7841+ assert tick .label1 .get_color () == 'red'
7842+
7843+
78147844@pytest .mark .parametrize ('size' , [size for size in mfont_manager .font_scalings
78157845 if size is not None ] + [8 , 10 , 12 ])
78167846@mpl .style .context ('default' )
You can’t perform that action at this time.
0 commit comments