Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d501de7

Browse filesBrowse files
committed
FIX: only update the kwargs asked for in tick_params
1 parent b7a4db0 commit d501de7
Copy full SHA for d501de7

File tree

Expand file treeCollapse file tree

1 file changed

+7
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-12
lines changed

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+7-12Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -826,40 +826,35 @@ def set_tick_params(self, which='major', reset=False, **kw):
826826
For documentation of keyword arguments, see
827827
:meth:`matplotlib.axes.Axes.tick_params`.
828828
"""
829-
blacklist = ['tick1On', 'tick2On', 'label1On', 'label2On', 'gridOn']
830829
dicts = []
831-
blacklist_dicts = []
832830
if which == 'major' or which == 'both':
833831
dicts.append(self._major_tick_kw)
834832
if which == 'minor' or which == 'both':
835833
dicts.append(self._minor_tick_kw)
836834
kwtrans = self._translate_tick_kw(kw)
837835

836+
# this stashes the parameter changes so any new ticks will
837+
# automatically get them
838838
for d in dicts:
839839
if reset:
840840
d.clear()
841-
blacklist_dicts.append(
842-
{
843-
k: d.pop(k) for k in blacklist
844-
if k in d.keys() and k not in kwtrans.keys()
845-
}
846-
)
847841
d.update(kwtrans)
848842

849843
if reset:
850844
self.reset_ticks()
851845
else:
846+
# apply the new kwargs to the existing ticks
852847
if which == 'major' or which == 'both':
853848
for tick in self.majorTicks:
854-
tick._apply_params(**self._major_tick_kw)
849+
tick._apply_params(**kwtrans)
855850
if which == 'minor' or which == 'both':
856851
for tick in self.minorTicks:
857-
tick._apply_params(**self._minor_tick_kw)
852+
tick._apply_params(**kwtrans)
853+
# special-case label color to also apply to the offset
854+
# text
858855
if 'labelcolor' in kwtrans:
859856
self.offsetText.set_color(kwtrans['labelcolor'])
860857

861-
for d, bd in zip(dicts, blacklist_dicts):
862-
d.update(bd)
863858
self.stale = True
864859

865860
@staticmethod

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.