Skip to content

Commit 07f694d

Browse files
committed
sometimes label index is the only MOVETO
1 parent 97f2650 commit 07f694d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/contour.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,10 @@ def _split_path_and_get_label_rotation(self, path, idx, screen_pos, lw, spacing=
370370
# path always starts with a MOVETO, and we consider there's an implicit
371371
# MOVETO (closing the last path) at the end.
372372
movetos = (codes == Path.MOVETO).nonzero()[0]
373-
start = movetos[movetos < idx][-1]
373+
try:
374+
start = movetos[movetos < idx][-1]
375+
except IndexError:
376+
start = idx
374377
try:
375378
stop = movetos[movetos > idx][0]
376379
except IndexError:

0 commit comments

Comments
 (0)