8000 BUG: fix a regression where tick direction wasn't conserved by Axis.clear() by neutrinoceros · Pull Request #23808 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

BUG: fix a regression where tick direction wasn't conserved by Axis.clear() #23808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations 8000
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@ def _reset_major_tick_kw(self, keep_tick_and_label_visibility=False):
*keep_tick_and_label_visibility*.
"""
backup = {name: value for name, value in self._major_tick_kw.items()
if name in ['tick1On', 'tick2On', 'label1On', 'label2On']}
if name in ['tick1On', 'tick2On', 'tickdir',
'label1On', 'label2On']}
self._major_tick_kw.clear()
if keep_tick_and_label_visibility:
self._major_tick_kw.update(backup)
Expand Down
11 changes: 11 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7665,6 +7665,17 @@ def test_2dcolor_plot(fig_test, fig_ref):
axs[4].bar(np.arange(10), np.arange(10), color=color.reshape((1, -1)))


@check_figures_equal(extensions=['png'])
def test_tickdir_axes_clear(fig_test, fig_ref):
# see https://github.com/matplotlib/matplotlib/issues/23806
ax = fig_ref.subplots(1, 1)
ax.tick_params(which='both', axis='both', direction='in')

ax = fig_test.subplots(1, 1)
ax.tick_params(which='both', axis='both', direction='in')
ax.clear()


@check_figures_equal(extensions=['png'])
def test_shared_axes_clear(fig_test, fig_ref):
x = np.arange(0.0, 2*np.pi, 0.01)
Expand Down
0