Parameters ---------- numsides : int The number of sides of the polygon. rotation : float The rotation of the polygon in radians. sizes : tuple of float The area of the circle circumscribing the polygon in points^2.
(self,
numsides,
*,
rotation=0,
sizes=(1,),
**kwargs)
| 1637 | _factor = np.pi ** (-1/2) |
| 1638 | |
| 1639 | def __init__(self, |
| 1640 | numsides, |
| 1641 | *, |
| 1642 | rotation=0, |
| 1643 | sizes=(1,), |
| 1644 | **kwargs): |
| 1645 | """ |
| 1646 | Parameters |
| 1647 | ---------- |
| 1648 | numsides : int |
| 1649 | The number of sides of the polygon. |
| 1650 | rotation : float |
| 1651 | The rotation of the polygon in radians. |
| 1652 | sizes : tuple of float |
| 1653 | The area of the circle circumscribing the polygon in points^2. |
| 1654 | **kwargs |
| 1655 | Forwarded to `.Collection`. |
| 1656 | |
| 1657 | Examples |
| 1658 | -------- |
| 1659 | See :doc:`/gallery/event_handling/lasso_demo` for a complete example:: |
| 1660 | |
| 1661 | offsets = np.random.rand(20, 2) |
| 1662 | facecolors = [cm.jet(x) for x in np.random.rand(20)] |
| 1663 | |
| 1664 | collection = RegularPolyCollection( |
| 1665 | numsides=5, # a pentagon |
| 1666 | rotation=0, sizes=(50,), |
| 1667 | facecolors=facecolors, |
| 1668 | edgecolors=("black",), |
| 1669 | linewidths=(1,), |
| 1670 | offsets=offsets, |
| 1671 | offset_transform=ax.transData, |
| 1672 | ) |
| 1673 | """ |
| 1674 | super().__init__(**kwargs) |
| 1675 | self.set_sizes(sizes) |
| 1676 | self._numsides = numsides |
| 1677 | self._paths = [self._path_generator(numsides)] |
| 1678 | self._rotation = rotation |
| 1679 | self.set_transform(transforms.IdentityTransform()) |
| 1680 | |
| 1681 | def get_numsides(self): |
| 1682 | return self._numsides |
nothing calls this directly
no test coverage detected