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

Skip to content

Tweak AnnotationBbox coords specification. #26069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ def draw(self, renderer=None):
offsetbox.add_artist(text_patch)

# place the anchored offset box using AnnotationBbox
ab = AnnotationBbox(offsetbox, (xpos, 0.5),
xycoords='data',
boxcoords="offset points",
box_alignment=(0.5, 0.5),
)
ab = AnnotationBbox(offsetbox, (xpos, 0.5), box_alignment=(0.5, 0.5))

ax2.add_artist(ab)

Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,9 +1224,7 @@ def __str__(self):
return f"AnnotationBbox({self.xy[0]:g},{self.xy[1]:g})"

@_docstring.dedent_interpd
def __init__(self, offsetbox, xy, xybox=None, *,
xycoords='data',
boxcoords=None,
def __init__(self, offsetbox, xy, xybox=None, xycoords='data', boxcoords=None, *,
frameon=True, pad=0.4, # FancyBboxPatch boxstyle.
annotation_clip=None,
box_alignment=(0.5, 0.5),
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/offsetbox.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
offsetbox: OffsetBox,
xy: tuple[float, float],
xybox: tuple[float, float] | None = ...,
*,
xycoords: str
| tuple[str, str]
| martist.Artist
Expand All @@ -252,6 +251,7 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
| Transform
| Callable[[RendererBase], Bbox | Transform]
| None = ...,
*,
frameon: bool = ...,
pad: float = ...,
annotation_clip: bool | None = ...,
Expand Down