From d772043d67603f0d0260fdbe990ba82e6f47f4c6 Mon Sep 17 00:00:00 2001 From: Scott Shambaugh Date: Wed, 11 Mar 2026 16:08:49 -0600 Subject: [PATCH] Ignore empty text for tightbbox --- lib/matplotlib/text.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index f30572382fe9..f0dd963fe477 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1042,6 +1042,8 @@ def get_window_extent(self, renderer=None, dpi=None): return bbox def get_tightbbox(self, renderer=None): + if not self.get_visible() or self.get_text() == "": + return Bbox.null() # Exclude text at data coordinates outside the valid domain of the axes # scales (e.g., negative coordinates with a log scale). if (self.axes