Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d23b8d

Browse files
committed
pyplot: do not apply kwargs twice in to x/yticklabels
If labels are given, `ax.set_xticklabels` is already passed the kwargs, so a subsequent `label.update(kwargs)` is not necessary.
1 parent a61f208 commit 8d23b8d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/matplotlib/pyplot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,10 +1797,10 @@ def xticks(ticks=None, labels=None, **kwargs):
17971797

17981798
if labels is None:
17991799
labels = ax.get_xticklabels()
1800+
for l in labels:
1801+
l.update(kwargs)
18001802
else:
18011803
labels = ax.set_xticklabels(labels, **kwargs)
1802-
for l in labels:
1803-
l.update(kwargs)
18041804

18051805
return locs, labels
18061806

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

18581858
if labels is None:
18591859
labels = ax.get_yticklabels()
1860+
for l in labels:
1861+
l.update(kwargs)
18601862
else:
18611863
labels = ax.set_yticklabels(labels, **kwargs)
1862-
for l in labels:
1863-
l.update(kwargs)
18641864

18651865
return locs, labels
18661866

0 commit comments

Comments
 (0)