Skip to content

Commit

Permalink
pyplot: do not apply kwargs twice in to x/yticklabels
Browse files Browse the repository at this point in the history
If labels are given, `ax.set_xticklabels` is already passed the kwargs,
so a subsequent `label.update(kwargs)` is not necessary.
  • Loading branch information
hmeine committed Apr 8, 2021
1 parent a61f208 commit 8d23b8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,10 +1797,10 @@ def xticks(ticks=None, labels=None, **kwargs):

if labels is None:
labels = ax.get_xticklabels()
for l in labels:
l.update(kwargs)
else:
labels = ax.set_xticklabels(labels, **kwargs)
for l in labels:
l.update(kwargs)

return locs, labels

Expand Down Expand Up @@ -1857,10 +1857,10 @@ def yticks(ticks=None, labels=None, **kwargs):

if labels is None:
labels = ax.get_yticklabels()
for l in labels:
l.update(kwargs)
else:
labels = ax.set_yticklabels(labels, **kwargs)
for l in labels:
l.update(kwargs)

return locs, labels

Expand Down

0 comments on commit 8d23b8d

Please sign in to comment.