Skip to content

Commit b558152

Browse files
Rename to _outside_axes_domain
1 parent 4ffb8d3 commit b558152

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/matplotlib/artist.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,21 +375,22 @@ def get_window_extent(self, renderer=None):
375375
"""
376376
return Bbox([[0, 0], [0, 0]])
377377

378-
def _in_axes_domain(self, x, y):
378+
def _outside_axes_domain(self, x, y):
379379
"""
380-
Check if the data point (x, y) is within the valid domain of the axes
380+
Check if the data point (x, y) is outside the valid domain of the axes
381381
scales.
382382
383-
Returns True if no axes or if the point is in the valid domain.
383+
Returns True if the artist is in an Axes (i.e. self.axes is set) but
384+
outside the data range.
384385
"""
385386
ax = self.axes
386387
if ax is None:
387-
return True
388+
return False
388389
for val, axis in [(x, ax.xaxis), (y, ax.yaxis)]:
389390
vmin, vmax = axis.limit_range_for_scale(val, val)
390391
if vmin != val or vmax != val:
391-
return False
392-
return True
392+
return True
393+
return False
393394

394395
def get_tightbbox(self, renderer=None):
395396
"""

lib/matplotlib/text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,8 @@ def get_window_extent(self, renderer=None, dpi=None):
10631063
def get_tightbbox(self, renderer=None):
10641064
# Exclude text at data coordinates outside the valid domain of the axes
10651065
# scales (e.g., negative coordinates with a log scale).
1066-
if (self.axes is not None and self.get_transform() == self.axes.transData
1067-
and not self._in_axes_domain(*self.get_unitless_position())):
1066+
if (self._outside_axes_domain(*self.get_unitless_position())
1067+
and self.get_transform() == self.axes.transData):
10681068
return Bbox.null()
10691069
return super().get_tightbbox(renderer)
10701070

0 commit comments

Comments
 (0)