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

Skip to content

TYP: Fix type hint (and docstring) for Bbox.intersection #25710

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
Apr 17, 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
5 changes: 3 additions & 2 deletions lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,17 @@ def get_tightbbox(self, renderer=None):

Returns
-------
`.Bbox`
`.Bbox` or None
The enclosing bounding box (in figure pixel coordinates).
Returns None if clipping results in no intersection.
"""
bbox = self.get_window_extent(renderer)
if self.get_clip_on():
clip_box = self.get_clip_box()
if clip_box is not None:
bbox = Bbox.intersection(bbox, clip_box)
clip_path = self.get_clip_path()
if clip_path is not None:
if clip_path is not None and bbox is not None:
clip_path = clip_path.get_fully_transformed_path()
bbox = Bbox.intersection(bbox, clip_path.get_extents())
return bbox
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/transforms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class BboxBase(TransformNode):
@staticmethod
def union(bboxes: Sequence[BboxBase]) -> Bbox: ...
@staticmethod
def intersection(bbox1: BboxBase, bbox2: BboxBase) -> Bbox: ...
def intersection(bbox1: BboxBase, bbox2: BboxBase) -> Bbox | None: ...

class Bbox(BboxBase):
def __init__(self, points: ArrayLike, **kwargs) -> None: ...
Expand Down