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

Skip to content

Commit e4dafa2

Browse files
committed
BUG: Prevent overwriting of tick visiblity
1 parent f075b1b commit e4dafa2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/matplotlib/axis.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,16 +826,21 @@ 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']
829830
dicts = []
831+
blacklist_dicts = []
830832
if which == 'major' or which == 'both':
831833
dicts.append(self._major_tick_kw)
832834
if which == 'minor' or which == 'both':
833835
dicts.append(self._minor_tick_kw)
834836
kwtrans = self._translate_tick_kw(kw)
837+
835838
for d in dicts:
836839
if reset:
837840
d.clear()
841+
blacklist_dicts.append({k:d.pop(k) for k in blacklist if k in d.keys()})
838842
d.update(kwtrans)
843+
[blacklist_dicts[-1].pop(k, None) for k in kwtrans.keys()]
839844

840845
if reset:
841846
self.reset_ticks()
@@ -848,6 +853,9 @@ def set_tick_params(self, which='major', reset=False, **kw):
848853
tick._apply_params(**self._minor_tick_kw)
849854
if 'labelcolor' in kwtrans:
850855
self.offsetText.set_color(kwtrans['labelcolor'])
856+
857+
for d,bd in zip(dicts, blacklist_dicts):
858+
d.update(bd)
851859
self.stale = True
852860

853861
@staticmethod

0 commit comments

Comments
 (0)