MCPcopy
hub / github.com/matplotlib/matplotlib / make_compound_path

Method make_compound_path

lib/matplotlib/path.py:339–358  ·  view source on GitHub ↗

r""" Concatenate a list of `Path`\s into a single `Path`, removing all `STOP`\s.

(cls, *args)

Source from the content-addressed store, hash-verified

337
338 @classmethod
339 def make_compound_path(cls, *args):
340 r"""
341 Concatenate a list of `Path`\s into a single `Path`, removing all `STOP`\s.
342 """
343 if not args:
344 return Path(np.empty([0, 2], dtype=np.float32))
345 vertices = np.concatenate([path.vertices for path in args])
346 codes = np.empty(len(vertices), dtype=cls.code_type)
347 i = 0
348 for path in args:
349 size = len(path.vertices)
350 if path.codes is None:
351 if size:
352 codes[i] = cls.MOVETO
353 codes[i+1:i+size] = cls.LINETO
354 else:
355 codes[i:i+size] = path.codes
356 i += size
357 not_stop_mask = codes != cls.STOP # Remove STOPs, as internal STOPs are a bug.
358 return cls(vertices[not_stop_mask], codes[not_stop_mask])
359
360 def __repr__(self):
361 return f"Path({self.vertices!r}, {self.codes!r})"

Callers 11

interpolatedMethod · 0.95
clip_to_bboxMethod · 0.95
drawMethod · 0.80
get_pathMethod · 0.80
labelsMethod · 0.80
_process_argsMethod · 0.80
plot_pathsFunction · 0.80
test_clip_to_bboxFunction · 0.80
test_clippingFunction · 0.80

Calls 1

PathClass · 0.85

Tested by 5

plot_pathsFunction · 0.64
test_clip_to_bboxFunction · 0.64
test_clippingFunction · 0.64