10000 Merge pull request #8980 from anntzer/clip_path_docstring · matplotlib/matplotlib@a57a80c · GitHub
[go: up one dir, main page]

Skip to content

Commit a57a80c

Browse files
authored
Merge pull request #8980 from anntzer/clip_path_docstring
Fix docstring of set_clip_path.
2 parents 7981274 + 46190eb commit a57a80c

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

lib/matplotlib/artist.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -668,18 +668,16 @@ def set_clip_path(self, path, transform=None):
668668
"""
669669
Set the artist's clip path, which may be:
670670
671-
* a :class:`~matplotlib.patches.Patch` (or subclass) instance
671+
- a :class:`~matplotlib.patches.Patch` (or subclass) instance; or
672+
- a :class:`~matplotlib.path.Path` instance, in which case a
673+
:class:`~matplotlib.transforms.Transform` instance, which will be
674+
applied to the path before using it for clipping, must be provided;
675+
or
676+
- ``None``, to remove a previously set clipping path.
672677
673-
* a :class:`~matplotlib.path.Path` instance, in which case
674-
an optional :class:`~matplotlib.transforms.Transform`
675-
instance may be provided, which will be applied to the
676-
path before using it for clipping.
677-
678-
* *None*, to remove the clipping path
679-
680-
For efficiency, if the path happens to be an axis-aligned
681-
rectangle, this method will set the clipping box to the
682-
corresponding rectangle and set the clipping path to *None*.
678+
For efficiency, if the path happens to be an axis-aligned rectangle,
679+
this method will set the clipping box to the corresponding rectangle
680+
and set the clipping path to ``None``.
683681
684682
ACCEPTS: [ (:class:`~matplotlib.path.Path`,
685683
:class:`~matplotlib.transforms.Transform`) |
@@ -714,10 +712,11 @@ def set_clip_path(self, path, transform=None):
714712
success = True
715713

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

0 commit comments

Comments
 (0)
0