Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ENH]: Ellipse annotation #24568

Copy link
Copy link
Closed
Closed
Copy link
@oscargus

Description

@oscargus
Issue body actions

Problem

Currently there is only a circle annotation among the "round" annotations, which can be quite big for long texts.

Proposed solution

Add an ellipse annotation. Equations can be found here (second answer): https://stackoverflow.com/questions/433371/ellipse-bounding-a-rectangle

The code will be very similar to the circle annotation:

@_register_style(_style_list)
class Circle:
"""A circular box."""
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, x0, y0, width, height, mutation_size):
pad = mutation_size * self.pad
width, height = width + 2 * pad, height + 2 * pad
# boundary of the padded box
x0, y0 = x0 - pad, y0 - pad
return Path.circle((x0 + width / 2, y0 + height / 2),
max(width, height) / 2)

but with an ellipse rather than a circle.

There is also a bit of documentation to update, e.g., https://matplotlib.org/stable/tutorials/text/annotations.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.