From 13aa00d915bab1b024cbcce201d0a4bc6ac3049d Mon Sep 17 00:00:00 2001 From: Mikhail Terekhov Date: Fri, 31 Jan 2014 22:10:17 -0500 Subject: [PATCH] Check that textRects is not empty, otherwise np.max raises ValueError. --- pyqtgraph/graphicsItems/AxisItem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index 2a5380ec..a8509db3 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -810,10 +810,10 @@ class AxisItem(GraphicsWidget): ## measure all text, make sure there's enough room if axis == 0: textSize = np.sum([r.height() for r in textRects]) - textSize2 = np.max([r.width() for r in textRects]) + textSize2 = np.max([r.width() for r in textRects]) if textRects else 0 else: textSize = np.sum([r.width() for r in textRects]) - textSize2 = np.max([r.height() for r in textRects]) + textSize2 = np.max([r.height() for r in textRects]) if textRects else 0 ## If the strings are too crowded, stop drawing text now. ## We use three different crowding limits based on the number