MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / Ellipse

Class Ellipse

lib/matplotlib/patches.py:1701–1878  ·  view source on GitHub ↗

A scale-free ellipse.

Source from the content-addressed store, hash-verified

1699
1700
1701class Ellipse(Patch):
1702 """A scale-free ellipse."""
1703
1704 def __str__(self):
1705 pars = (self._center[0], self._center[1],
1706 self.width, self.height, self.angle)
1707 fmt = "Ellipse(xy=(%s, %s), width=%s, height=%s, angle=%s)"
1708 return fmt % pars
1709
1710 @_docstring.interpd
1711 def __init__(self, xy, width, height, *, angle=0, **kwargs):
1712 """
1713 Parameters
1714 ----------
1715 xy : (float, float)
1716 xy coordinates of ellipse centre.
1717 width : float
1718 Total length (diameter) of horizontal axis.
1719 height : float
1720 Total length (diameter) of vertical axis.
1721 angle : float, default: 0
1722 Rotation in degrees anti-clockwise.
1723
1724 Notes
1725 -----
1726 Valid keyword arguments are:
1727
1728 %(Patch:kwdoc)s
1729 """
1730 super().__init__(**kwargs)
1731
1732 self._center = xy
1733 self._width, self._height = width, height
1734 self._angle = angle
1735 self._path = Path.unit_circle()
1736 # Required for EllipseSelector with axes aspect ratio != 1
1737 # The patch is defined in data coordinates and when changing the
1738 # selector with square modifier and not in data coordinates, we need
1739 # to correct for the aspect ratio difference between the data and
1740 # display coordinate systems.
1741 self._aspect_ratio_correction = 1.0
1742 # Note: This cannot be calculated until this is added to an Axes
1743 self._patch_transform = transforms.IdentityTransform()
1744
1745 def _recompute_transform(self):
1746 """
1747 Notes
1748 -----
1749 This cannot be called until after this has been added to an Axes,
1750 otherwise unit conversion will fail. This makes it very important to
1751 call the accessor method and not directly access the transformation
1752 member variable.
1753 """
1754 center = (self.convert_xunits(self._center[0]),
1755 self.convert_yunits(self._center[1]))
1756 width = self.convert_xunits(self._width)
1757 height = self.convert_yunits(self._height)
1758 self._patch_transform = transforms.Affine2D() \

Callers 13

test_anchored_artistsFunction · 0.90
test_corner_centerFunction · 0.90
test_ellipse_verticesFunction · 0.90
annotations.pyFile · 0.90
confidence_ellipseFunction · 0.90
ellipse_demo.pyFile · 0.90
hatch_demo.pyFile · 0.90
ellipse_arrow.pyFile · 0.90
annotation_demo.pyFile · 0.90
draw_ellipseFunction · 0.90

Calls

no outgoing calls

Tested by 5

test_anchored_artistsFunction · 0.72
test_corner_centerFunction · 0.72
test_ellipse_verticesFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…