Skip to content

Commit c1ce1de

Browse files
authored
Merge pull request matplotlib#19087 from jklymak/fix-recursively-remove-ticks
FIX/TST: recursively remove ticks
2 parents a022490 + c0a31f0 commit c1ce1de

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def _checked_on_freetype_version(required_freetype_version):
111111
def remove_ticks_and_titles(figure):
112112
figure.suptitle("")
113113
null_formatter = ticker.NullFormatter()
114-
for ax in figure.get_axes():
114+
def remove_ticks(ax):
115+
"""Remove ticks in *ax* and all its child Axes."""
115116
ax.set_title("")
116117
ax.xaxis.set_major_formatter(null_formatter)
117118
ax.xaxis.set_minor_formatter(null_formatter)
@@ -122,6 +123,10 @@ def remove_ticks_and_titles(figure):
122123
ax.zaxis.set_minor_formatter(null_formatter)
123124
except AttributeError:
124125
pass
126+
for child in ax.child_axes:
127+
remove_ticks(child)
128+
for ax in figure.get_axes():
129+
remove_ticks(ax)
125130

126131

127132
def _raise_on_image_difference(expected, actual, tol):

0 commit comments

Comments
 (0)