File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 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):
474474 self .axes [0 ].set_title (self .title )
475475
476476 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 )
483491
484492 @property
485493 def legend_title (self ):
You can’t perform that action at this time.
0 commit comments