Skip to content

Commit eb05129

Browse files
committed
PERF: speed up MPLPlot._apply_axis_properties by skipping expensive tick
enumeration where feasible
1 parent 6375549 commit eb05129

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pandas/plotting/_core.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,13 @@ def _adorn_subplots(self):
468468
self.axes[0].set_title(self.title)
469469

470470
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+
if rot is not None or fontsize is not None:
472+
labels = axis.get_majorticklabels() + axis.get_minorticklabels()
473+
for label in labels:
474+
if rot is not None:
475+
label.set_rotation(rot)
476+
if fontsize is not None:
477+
label.set_fontsize(fontsize)
477478

478479
@property
479480
def legend_title(self):

0 commit comments

Comments
 (0)