File tree 1 file changed +14
-6
lines changed
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -468,12 +468,20 @@ def _adorn_subplots(self):
468
468
self .axes [0 ].set_title (self .title )
469
469
470
470
def _apply_axis_properties (self , axis , rot = None , fontsize = None ):
471
- labels = axis .get_majorticklabels () + axis .get_minorticklabels ()
472
- for label in labels :
473
- if rot is not None :
474
- label .set_rotation (rot )
475
- if fontsize is not None :
476
- label .set_fontsize (fontsize )
471
+ """ Tick creation within matplotlib is reasonably expensive and is
472
+ internally deferred until accessed as Ticks are created/destroyed
473
+ multiple times per draw. It's therefore beneficial for us to avoid
474
+ accessing unless we will act on the Tick.
475
+ """
476
+
477
+ if rot is not None or fontsize is not None :
478
+ # rot=0 is a valid setting, hence the explicit None check
479
+ labels = axis .get_majorticklabels () + axis .get_minorticklabels ()
480
+ for label in labels :
481
+ if rot is not None :
482
+ label .set_rotation (rot )
483
+ if fontsize is not None :
484
+ label .set_fontsize (fontsize )
477
485
478
486
@property
479
487
def legend_title (self ):
You can’t perform that action at this time.
0 commit comments