MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / Rectangle

Class Rectangle

site-packages/matplotlib/patches.py:625–791  ·  view source on GitHub ↗

Draw a rectangle with lower left at *xy* = (*x*, *y*) with specified *width*, *height* and rotation *angle*.

Source from the content-addressed store, hash-verified

623
624
625class Rectangle(Patch):
626 """
627 Draw a rectangle with lower left at *xy* = (*x*, *y*) with
628 specified *width*, *height* and rotation *angle*.
629 """
630
631 def __str__(self):
632 pars = self._x0, self._y0, self._width, self._height, self.angle
633 fmt = "Rectangle(xy=(%g, %g), width=%g, height=%g, angle=%g)"
634 return fmt % pars
635
636 @docstring.dedent_interpd
637 def __init__(self, xy, width, height, angle=0.0, **kwargs):
638 """
639 Parameters
640 ----------
641 xy : (float, float)
642 The bottom and left rectangle coordinates
643 width : float
644 Rectangle width
645 height : float
646 Rectangle height
647 angle : float, optional
648 rotation in degrees anti-clockwise about *xy* (default is 0.0)
649 fill : bool, optional
650 Whether to fill the rectangle (default is ``True``)
651
652 Notes
653 -----
654 Valid kwargs are:
655 %(Patch)s
656 """
657
658 Patch.__init__(self, **kwargs)
659
660 self._x0 = xy[0]
661 self._y0 = xy[1]
662
663 self._width = width
664 self._height = height
665
666 self._x1 = self._x0 + self._width
667 self._y1 = self._y0 + self._height
668
669 self.angle = float(angle)
670 # Note: This cannot be calculated until this is added to an Axes
671 self._rect_transform = transforms.IdentityTransform()
672
673 def get_path(self):
674 """
675 Return the vertices of the rectangle.
676 """
677 return Path.unit_rectangle()
678
679 def _update_patch_transform(self):
680 """NOTE: This cannot be called until after this has been added
681 to an Axes, otherwise unit conversion will fail. This
682 makes it very important to call the accessor method and

Callers 13

__init__Method · 0.90
__init__Method · 0.90
_create_patchMethod · 0.90
create_artistsMethod · 0.90
test_rotate_rectFunction · 0.90
test_negative_rectFunction · 0.90
test_multi_color_hatchFunction · 0.90
add_offsetboxesFunction · 0.90
bbox_artistFunction · 0.85
draw_bboxFunction · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by 4

test_rotate_rectFunction · 0.72
test_negative_rectFunction · 0.72
test_multi_color_hatchFunction · 0.72
add_offsetboxesFunction · 0.72