diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index d80b168ea90a..30fc59684df0 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -440,7 +440,7 @@ def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5): # Actually break contours if closed: # This will remove contour if shorter than label - if np.all(I != -1): + if all(i != -1 for i in I): nlc.append(np.row_stack([xy2, lc[I[1]:I[0]+1], xy1])) else: # These will remove pieces of contour if they have length zero