@@ -194,7 +194,7 @@ def clabel(self, levels=None, *,
194194 return self .labelTextsList
195195
196196 def print_label (self , linecontour , labelwidth ):
197- """Return *False* if contours are too short for a label."""
197+ """Return whether a contour is long enough to hold a label."""
198198 return (len (linecontour ) > 10 * labelwidth
199199 or (np .ptp (linecontour , axis = 0 ) > 1.2 * labelwidth ).any ())
200200
@@ -514,13 +514,8 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
514514 # now lw in pixels
515515
516516 # Figure out label rotation.
517- if inline :
518- lcarg = lc
519- else :
520- lcarg = None
521517 rotation , nlc = self .calc_label_rot_and_inline (
522- slc , imin , lw , lcarg ,
523- inline_spacing )
518+ slc , imin , lw , lc if inline else None , inline_spacing )
524519
525520 self .add_label (xmin , ymin , rotation , self .labelLevelList [lmin ],
526521 self .labelCValueList [lmin ])
@@ -574,13 +569,8 @@ def labels(self, inline, inline_spacing):
574569 if self .print_label (slc , lw ):
575570 x , y , ind = self .locate_label (slc , lw )
576571
577- if inline :
578- lcarg = lc
579- else :
580- lcarg = None
581572 rotation , new = self .calc_label_rot_and_inline (
582- slc0 , ind , lw , lcarg ,
583- inline_spacing )
573+ slc0 , ind , lw , lc if inline else None , inline_spacing )
584574
585575 # Actually add the label
586576 add_label (x , y , rotation , lev , cvalue )
0 commit comments