8000 FIX: ignore axes that aren't visible · matplotlib/matplotlib@8a12e8b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a12e8b

Browse files
committed
FIX: ignore axes that aren't visible
1 parent 860803d commit 8a12e8b

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/matplotlib/_constrained_layout.py

-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,7 @@ def _make_ghost_gridspec_slots(fig, gs):
254254
# this gridspec slot doesn't have an axis so we
255255
# make a "ghost".
256256
ax = fig.add_subplot(gs[nn])
257-
ax.set_frame_on(False)
258-
ax.set_xticks([])
259-
ax.set_yticks([])
260-
ax.set_facecolor((1, 0, 0, 0))
257+
ax.set_visible(False)
261258

262259

263260
def _make_layout_margins(ax, renderer, h_pad, w_pad):

lib/matplotlib/backend_bases.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,7 @@ def enter_notify_event(self, guiEvent=None, xy=None):
18321832

18331833
def inaxes(self, xy):
18341834
"""
1835-
Return the topmost `~.axes.Axes` containing the point *xy*.
1835+
Return the topmost visible `~.axes.Axes` containing the point *xy*.
18361836
18371837
Parameters
18381838
----------
@@ -1842,11 +1842,10 @@ def inaxes(self, xy):
18421842
Returns
18431843
-------
18441844
axes : `~matplotlib.axes.Axes` or None
1845-
The topmost axes containing the point, or None if no axes.
1845+
The topmost visible axes containing the point, or None if no axes.
18461846
"""
18471847
axes_list = [a for a in self.figure.get_axes()
1848-
if a.patch.contains_point(xy)]
1849-
1848+
if a.patch.contains_point(xy) and a.get_visible()]
18501849
if axes_list:
18511850
axes = cbook._topmost_artist(axes_list)
18521851
else:

0 commit comments

Comments
 (0)
0