8000 Fix docstring of set_clip_path. by anntzer · Pull Request #8980 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix docstring of set_clip_path. #8980

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
Aug 2, 2017
Merged
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
29 changes: 14 additions & 15 deletions lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,18 +668,16 @@ def set_clip_path(self, path, transform=None):
"""
Set the artist's clip path, which may be:

* a :class:`~matplotlib.patches.Patch` (or subclass) instance
- a :class:`~matplotlib.patches.Patch` (or subclass) instance; or
- a :class:`~matplotlib.path.Path` instance, in which case a
:class:`~matplot 8000 lib.transforms.Transform` instance, which will be
applied to the path before using it for clipping, must be provided;
or
- ``None``, to remove a previously set clipping path.

* a :class:`~matplotlib.path.Path` instance, in which case
an optional :class:`~matplotlib.transforms.Transform`
instance may be provided, which will be applied to the
path before using it for clipping.

* *None*, to remove the clipping path

For efficiency, if the path happens to be an axis-aligned
rectangle, this method will set the clipping box to the
corresponding rectangle and set the clipping path to *None*.
For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to ``None``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any docs elsewhere that explains the clipping path/box distinction? If so, it would be nice to reference it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Feel free to push or force-push a fix to the PR.


ACCEPTS: [ (:class:`~matplotlib.path.Path`,
:class:`~matplotlib.transforms.Transform`) |
Expand Down Expand Up @@ -714,10 +712,11 @@ def set_clip_path(self, path, transform=None):
success = True

if not success:
print(type(path), type(transform))
raise TypeError("Invalid arguments to set_clip_path")
# this may result in the callbacks being hit twice, but grantees they
# will be hit at least once
raise TypeError(
"Invalid arguments to set_clip_path, of type {} and {}"
.format(type(path).__name__, type(transform).__name__))
# This may result in the callbacks being hit twice, but guarantees they
# will be hit at least once.
self.pchanged()
self.stale = True

Expand Down
0