Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add fig.add_artist method#11234
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1048,6 +1048,42 @@ def fixlist(args): | ||
key = fixlist(args), fixitems(kwargs.items()) | ||
return key | ||
def add_artist(self, artist, clip=False): | ||
""" | ||
Add any :class:`~matplotlib.artist.Artist` to the figure. | ||
Usually artists are added to axes objects using | ||
:meth:`matplotlib.axes.Axes.add_artist`, but use this method in the | ||
rare cases that adding directly to the figure is necessary. | ||
Parameters | ||
---------- | ||
artist : `~matplotlib.artist.Artist` | ||
The artist to add to the figure. If the added artist has no | ||
transform previously set, its transform will be set to | ||
``figure.transFigure``. | ||
clip : bool, optional, default ``False`` | ||
An optional parameter ``clip`` determines whether the added artist | ||
should be clipped by the figure patch. Default is *False*, | ||
i.e. no clipping. | ||
Returns | ||
------- | ||
artist : The added `~matplotlib.artist.Artist` | ||
""" | ||
artist.set_figure(self) | ||
self.artists.append(artist) | ||
artist._remove_method = self.artists.remove | ||
if not artist.is_transform_set(): | ||
artist.set_transform(self.transFigure) | ||
if clip: | ||
artist.set_clip_path(self.patch) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This should always be passed, unless you can guarantee that the clip path was always There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Actually, I think I misread this, and thought | ||
self.stale = True | ||
return artist | ||
@docstring.dedent_interpd | ||
def add_axes(self, *args, **kwargs): | ||
""" | ||