From f032721c4f12c85104081e6c68a0371e32c531be Mon Sep 17 00:00:00 2001 From: MarceloCMiguel Date: Thu, 1 Dec 2022 11:06:59 -0300 Subject: [PATCH] ellipse class --- lib/matplotlib/patches.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index f127ab20a97b..2386518a5710 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -2338,6 +2338,24 @@ def __call__(self, x0, y0, width, height, mutation_size): x0, y0 = x0 - pad, y0 - pad return Path.circle((x0 + width / 2, y0 + height / 2), max(width, height) / 2) + + @_register_style(_style_list) + class Ellipse: + """A ellipse curve.""" + + def __init__(self, pad=0.3): + """ + Parameters + ---------- + pad : float, default: 0.3 + The amount of padding around the original box. + """ + self.pad = pad + + def __call__(self,width, height, mutation_size): + ellipse_path = transforms.Affine2D().scale(width, height).transform_path(Path.unit_circle()) + + return ellipse_path @_register_style(_style_list) class LArrow: