Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 707edb5

Browse files
committed
Fix #1583: Crash with text.usetex=True and plt.annotate -- usetex bounding boxes are all NaNs when text is empty.
1 parent ccb923e commit 707edb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def get_window_extent(self, renderer=None, dpi=None):
740740
if dpi is not None:
741741
dpi_orig = self.figure.dpi
742742
self.figure.dpi = dpi
743-
if self.get_text() == '':
743+
if self.get_text().strip() == '':
744744
tx, ty = self._get_xy_display()
745745
return Bbox.from_bounds(tx,ty,0,0)
746746

0 commit comments

Comments
 (0)