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

Skip to content

Commit 8a44942

Browse files
committed
Cleanup "code that should be eventually removed" and is now unnedded.
(locate_label has no division, print_label explicitly suppresses the division by zero warning.)
1 parent ab9e58c commit 8a44942

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lib/matplotlib/contour.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -554,23 +554,14 @@ def labels(self, inline, inline_spacing):
554554
paths = con.get_paths()
555555
for segNum, linepath in enumerate(paths):
556556
lc = linepath.vertices # Line contour
557-
slc0 = trans.transform(lc) # Line contour in screen coords
558-
559-
# For closed polygons, add extra point to avoid division by
560-
# zero in print_label and locate_label. Other than these
561-
# functions, this is not necessary and should probably be
562-
# eventually removed.
563-
if _is_closed_polygon(lc):
564-
slc = np.row_stack([slc0, slc0[1:2]])
565-
else:
566-
slc = slc0
557+
slc = trans.transform(lc) # Line contour in screen coords
567558

568559
# Check if long enough for a label
569560
if self.print_label(slc, lw):
570561
x, y, ind = self.locate_label(slc, lw)
571562

572563
rotation, new = self.calc_label_rot_and_inline(
573-
slc0, ind, lw, lc if inline else None, inline_spacing)
564+
slc, ind, lw, lc if inline else None, inline_spacing)
574565

575566
# Actually add the label
576567
add_label(x, y, rotation, lev, cvalue)

0 commit comments

Comments
 (0)