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 345d4ca

Browse filesBrowse files
committed
Don't draw invisible 3D Axes
Also, add a test for cartesian Axes as well. Fixes #23308
1 parent 97fc115 commit 345d4ca
Copy full SHA for 345d4ca

File tree

Expand file treeCollapse file tree

3 files changed

+15
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-1
lines changed

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
# the tests with multiple threads.
4646

4747

48+
@check_figures_equal(extensions=["png"])
49+
def test_invisible_axes(fig_test, fig_ref):
50+
ax = fig_test.subplots()
51+
ax.set_visible(False)
52+
53+
4854
def test_get_labels():
4955
fig, ax = plt.subplots()
5056
ax.set_xlabel('x label')
@@ -7319,7 +7325,7 @@ def test_redraw_in_frame():
73197325
ax.redraw_in_frame()
73207326

73217327

7322-
def test_invisible_axes():
7328+
def test_invisible_axes_events():
73237329
# invisible axes should not respond to events...
73247330
fig, ax = plt.subplots()
73257331
assert fig.canvas.inaxes((200, 200)) is not None

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ def apply_aspect(self, position=None):
387387

388388
@martist.allow_rasterization
389389
def draw(self, renderer):
390+
if not self.get_visible():
391+
return
390392
self._unstale_viewLim()
391393

392394
# draw the background patch

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
image_comparison, remove_text=True, style='default')
2222

2323

24+
@check_figures_equal(extensions=["png"])
25+
def test_invisible_axes(fig_test, fig_ref):
26+
ax = fig_test.subplots(subplot_kw=dict(projection='3d'))
27+
ax.set_visible(False)
28+
29+
2430
def test_aspect_equal_error():
2531
fig = plt.figure()
2632
ax = fig.add_subplot(projection='3d')

0 commit comments

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