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
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:
matplotlib/lib/matplotlib/patches.py
Lines 2327 to 2346 in dc0328f
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