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):
2259
2259
transform = mtransforms .blended_transform_factory (
2260
2260
self .axes .transAxes , mtransforms .IdentityTransform ()),
2261
2261
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' ],
2263
2265
)
2264
2266
self .offset_text_position = 'bottom'
2265
2267
@@ -2519,7 +2521,9 @@ def _init(self):
2519
2521
transform = mtransforms .blended_transform_factory (
2520
2522
self .axes .transAxes , mtransforms .IdentityTransform ()),
2521
2523
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' ],
2523
2527
)
2524
2528
self .offset_text_position = 'left'
2525
2529
Original file line number Diff line number Diff line change @@ -7811,6 +7811,36 @@ def test_ytickcolor_is_not_yticklabelcolor():
7811
7811
assert tick .label1 .get_color () == 'blue'
7812
7812
7813
7813
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
+
7814
7844
@pytest .mark .parametrize ('size' , [size for size in mfont_manager .font_scalings
7815
7845
if size is not None ] + [8 , 10 , 12 ])
7816
7846
@mpl .style .context ('default' )
You can’t perform that action at this time.
0 commit comments