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 @@ -474,12 +474,20 @@ def _adorn_subplots(self):
474
474
self .axes [0 ].set_title (self .title )
475
475
476
476
def _apply_axis_properties (self , axis , rot = None , fontsize = None ):
477
- labels = axis .get_majorticklabels () + axis .get_minorticklabels ()
478
- for label in labels :
479
- if rot is not None :
480
- label .set_rotation (rot )
481
- if fontsize is not None :
482
- label .set_fontsize (fontsize )
477
+ """ Tick creation within matplotlib is reasonably expensive and is
478
+ internally deferred until accessed as Ticks are created/destroyed
479
+ multiple times per draw. It's therefore beneficial for us to avoid
480
+ accessing unless we will act on the Tick.
481
+ """
482
+
483
+ if rot is not None or fontsize is not None :
484
+ # rot=0 is a valid setting, hence the explicit None check
485
+ labels = axis .get_majorticklabels () + axis .get_minorticklabels ()
486
+ for label in labels :
487
+ if rot is not None :
488
+ label .set_rotation (rot )
489
+ if fontsize is not None :
490
+ label .set_fontsize (fontsize )
483
491
484
492
@property
485
493
def legend_title (self ):
You can’t perform that action at this time.
0 commit comments