The DrawingArea can contain any Artist as a child. The DrawingArea has a fixed width and height. The position of children relative to the parent is fixed. The children can be clipped at the boundaries of the parent.
| 595 | |
| 596 | |
| 597 | class DrawingArea(OffsetBox): |
| 598 | """ |
| 599 | The DrawingArea can contain any Artist as a child. The DrawingArea |
| 600 | has a fixed width and height. The position of children relative to |
| 601 | the parent is fixed. The children can be clipped at the |
| 602 | boundaries of the parent. |
| 603 | """ |
| 604 | |
| 605 | def __init__(self, width, height, xdescent=0., ydescent=0., clip=False): |
| 606 | """ |
| 607 | Parameters |
| 608 | ---------- |
| 609 | width, height : float |
| 610 | Width and height of the container box. |
| 611 | xdescent, ydescent : float |
| 612 | Descent of the box in x- and y-direction. |
| 613 | clip : bool |
| 614 | Whether to clip the children to the box. |
| 615 | """ |
| 616 | super().__init__() |
| 617 | self.width = width |
| 618 | self.height = height |
| 619 | self.xdescent = xdescent |
| 620 | self.ydescent = ydescent |
| 621 | self._clip_children = clip |
| 622 | self.offset_transform = mtransforms.Affine2D() |
| 623 | self.dpi_transform = mtransforms.Affine2D() |
| 624 | |
| 625 | @property |
| 626 | def clip_children(self): |
| 627 | """ |
| 628 | If the children of this DrawingArea should be clipped |
| 629 | by DrawingArea bounding box. |
| 630 | """ |
| 631 | return self._clip_children |
| 632 | |
| 633 | @clip_children.setter |
| 634 | def clip_children(self, val): |
| 635 | self._clip_children = bool(val) |
| 636 | self.stale = True |
| 637 | |
| 638 | def get_transform(self): |
| 639 | """ |
| 640 | Return the `~matplotlib.transforms.Transform` applied to the children. |
| 641 | """ |
| 642 | return self.dpi_transform + self.offset_transform |
| 643 | |
| 644 | def set_transform(self, t): |
| 645 | """ |
| 646 | set_transform is ignored. |
| 647 | """ |
| 648 | |
| 649 | def set_offset(self, xy): |
| 650 | """ |
| 651 | Set the offset of the container. |
| 652 | |
| 653 | Parameters |
| 654 | ---------- |
no outgoing calls
searching dependent graphs…