A collection of 3D lines.
| 482 | |
| 483 | |
| 484 | class Line3DCollection(LineCollection): |
| 485 | """ |
| 486 | A collection of 3D lines. |
| 487 | """ |
| 488 | def __init__(self, lines, axlim_clip=False, **kwargs): |
| 489 | super().__init__(lines, **kwargs) |
| 490 | self._axlim_clip = axlim_clip |
| 491 | """ |
| 492 | Parameters |
| 493 | ---------- |
| 494 | lines : list of (N, 3) array-like |
| 495 | A sequence ``[line0, line1, ...]`` where each line is a (N, 3)-shape |
| 496 | array-like containing points:: line0 = [(x0, y0, z0), (x1, y1, z1), ...] |
| 497 | Each line can contain a different number of points. |
| 498 | linewidths : float or list of float, default: :rc:`lines.linewidth` |
| 499 | The width of each line in points. |
| 500 | colors : :mpltype:`color` or list of color, default: :rc:`lines.color` |
| 501 | A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not |
| 502 | allowed). |
| 503 | antialiaseds : bool or list of bool, default: :rc:`lines.antialiased` |
| 504 | Whether to use antialiasing for each line. |
| 505 | facecolors : :mpltype:`color` or list of :mpltype:`color`, default: 'none' |
| 506 | When setting *facecolors*, each line is interpreted as a boundary |
| 507 | for an area, implicitly closing the path from the last point to the |
| 508 | first point. The enclosed area is filled with *facecolor*. |
| 509 | In order to manually specify what should count as the "interior" of |
| 510 | each line, please use `.PathCollection` instead, where the |
| 511 | "interior" can be specified by appropriate usage of |
| 512 | `~.path.Path.CLOSEPOLY`. |
| 513 | **kwargs : Forwarded to `.Collection`. |
| 514 | """ |
| 515 | |
| 516 | def set_sort_zpos(self, val): |
| 517 | """Set the position to use for z-sorting.""" |
| 518 | self._sort_zpos = val |
| 519 | self.stale = True |
| 520 | |
| 521 | def set_segments(self, segments): |
| 522 | """ |
| 523 | Set 3D segments. |
| 524 | """ |
| 525 | self._segments3d = segments |
| 526 | super().set_segments([]) |
| 527 | |
| 528 | def do_3d_projection(self): |
| 529 | """ |
| 530 | Project the points according to renderer matrix. |
| 531 | """ |
| 532 | segments = self._segments3d |
| 533 | |
| 534 | # Handle ragged inputs, but prefer a faster path for same-length segments |
| 535 | segment_lengths = [len(segment) for segment in segments] |
| 536 | ragged = len(set(segment_lengths)) > 1 |
| 537 | if ragged: |
| 538 | # Branch masked / non-masked for speed |
| 539 | if any(np.ma.isMA(segment) for segment in segments): |
| 540 | segments = np.ma.concatenate(segments) |
| 541 | else: |
no outgoing calls
searching dependent graphs…