Skip to content

Commit fea08e8

Browse files
committed
incorporate #16822
1 parent 687cd7a commit fea08e8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/matplotlib/path.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -326,22 +326,27 @@ def make_compound_path_from_polys(cls, XY):
326326

327327
@classmethod
328328
def make_compound_path(cls, *args):
329-
"""Make a compound path from a list of Path objects."""
329+
"""
330+
Make a compound path from a list of Path objects. Blindly removes all
331+
Path.STOP control points.
332+
"""
330333
# Handle an empty list in args (i.e. no args).
331334
if not args:
332335
return Path(np.empty([0, 2], dtype=np.float32))
333-
334336
vertices = np.concatenate([x.vertices for x in args])
335337
codes = np.empty(len(vertices), dtype=cls.code_type)
336338
i = 0
337339
for path in args:
338-
codes = path.codes
339-
if codes is None:
340-
codes = np.full(len(path.vertices), Path.LINETO,
341-
dtype=Path.code_type)
342-
codes[0] = Path.MOVETO # so concatenated strokes stay separate
343-
codes[i:i + len(path.codes)] = codes
340+
if path.codes is None:
341+
codes[i] = cls.MOVETO
342+
codes[i + 1:i + len(codes)] = cls.LINETO
343+
else:
344+
codes[i:i + len(path.codes)] = path.codes
344345
i += len(path.vertices)
346+
# remove STOP's, since internal STOPs are a bug
347+
not_stop_mask = codes != cls.STOP
348+
vertices = vertices[not_stop_mask, :]
349+
codes = codes[not_stop_mask]
345350

346351
return cls(vertices, codes)
347352

0 commit comments

Comments
 (0)