Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 923a90e

Browse files
committed
Add edge midpoint helper methods
1 parent 8eeae8e commit 923a90e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/patches.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,14 @@ def get_corners(self):
816816
return self.get_patch_transform().transform(
817817
[(0, 0), (1, 0), (1, 1), (0, 1)])
818818

819+
def _get_edge_midpoints(self):
820+
"""
821+
Return the edge midpoints of the rectangle, moving anti-clockwise from
822+
the center of the left-hand edge.
823+
"""
824+
return self.get_patch_transform().transform(
825+
[(0, 0.5), (0.5, 0), (1, 0.5), (0.5, 1)])
826+
819827
def get_center(self):
820828
"""Return the centre of the rectangle."""
821829
return self.get_patch_transform().transform((0.5, 0.5))
@@ -1681,6 +1689,14 @@ def get_corners(self):
16811689
return self.get_patch_transform().transform(
16821690
[(-1, -1), (1, -1), (1, 1), (-1, 1)])
16831691

1692+
def _get_edge_midpoints(self):
1693+
"""
1694+
Return the corners of the ellipse, moving anti-clockwise from
1695+
the center of the left-hand edge before rotation.
1696+
"""
1697+
return self.get_patch_transform().transform(
1698+
[(-1, 0), (0, -1), (1, 0), (0, 1)])
1699+
16841700

16851701
class Annulus(Patch):
16861702
"""

0 commit comments

Comments
 (0)