8000 BUG: fix a regression where tick direction wasn't conserved by Axis.c… · matplotlib/matplotlib@92cab09 · GitHub
[go: up one dir, main page]

Skip to content

Commit 92cab09

Browse files
committed
BUG: fix a regression where tick direction wasn't conserved by Axis.clear()
1 parent 25b39d4 commit 92cab09

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/matplotlib/axis.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,8 @@ def _reset_major_tick_kw(self, keep_tick_and_label_visibility=False):
855855
*keep_tick_and_label_visibility*.
856856
"""
857857
backup = {name: value for name, value in self._major_tick_kw.items()
858-
if name in ['tick1On', 'tick2On', 'label1On', 'label2On']}
858+
if name in ['tick1On', 'tick2On', 'tickdir',
859+
'label1On', 'label2On']}
859860
self._major_tick_kw.clear()
860861
if keep_tick_and_label_visibility:
861862
self._major_tick_kw.update(backup)

lib/matplotlib/tests/test_axes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7665,6 +7665,17 @@ def test_2dcolor_plot(fig_test, fig_ref):
76657665
axs[4].bar(np.arange(10), np.arange(10), color=color.reshape((1, -1)))
76667666

76677667

7668+
@check_figures_equal(extensions=['png'])
7669+
def test_tickdir_axes_clear(fig_test, fig_ref):
7670+
# see https://github.com/matplotlib/matplotlib/issues/23806
7671+
ax = fig_ref.subplots(1, 1)
7672+
ax.tick_params(which='both', axis='both', direction='in')
7673+
7674+
ax = fig_test.subplots(1, 1)
7675+
ax.tick_params(which='both', axis='both', direction='in')
7676+
ax.clear()
7677+
7678+
76687679
@check_figures_equal(extensions=['png'])
76697680
def test_shared_axes_clear(fig_test, fig_ref):
76707681
x = np.arange(0.0, 2*np.pi, 0.01)

0 commit comments

Comments
 (0)
0