Add an `.Artist` to the figure. Usually artists are added to `~.axes.Axes` objects using `.Axes.add_artist`; this method can be used in the rare cases where one needs to add artists directly to the figure instead. Parameters ---------- artis
(self, artist, clip=False)
| 501 | frameon = property(get_frameon, set_frameon) |
| 502 | |
| 503 | def add_artist(self, artist, clip=False): |
| 504 | """ |
| 505 | Add an `.Artist` to the figure. |
| 506 | |
| 507 | Usually artists are added to `~.axes.Axes` objects using |
| 508 | `.Axes.add_artist`; this method can be used in the rare cases where |
| 509 | one needs to add artists directly to the figure instead. |
| 510 | |
| 511 | Parameters |
| 512 | ---------- |
| 513 | artist : `~matplotlib.artist.Artist` |
| 514 | The artist to add to the figure. If the added artist has no |
| 515 | transform previously set, its transform will be set to |
| 516 | ``figure.transSubfigure``. |
| 517 | clip : bool, default: False |
| 518 | Whether the added artist should be clipped by the figure patch. |
| 519 | |
| 520 | Returns |
| 521 | ------- |
| 522 | `~matplotlib.artist.Artist` |
| 523 | The added artist. |
| 524 | """ |
| 525 | artist.set_figure(self) |
| 526 | self.artists.append(artist) |
| 527 | artist._remove_method = self.artists.remove |
| 528 | |
| 529 | if not artist.is_transform_set(): |
| 530 | artist.set_transform(self.transSubfigure) |
| 531 | |
| 532 | if clip and artist.get_clip_path() is None: |
| 533 | artist.set_clip_path(self.patch) |
| 534 | |
| 535 | self.stale = True |
| 536 | return artist |
| 537 | |
| 538 | @_docstring.interpd |
| 539 | def add_axes(self, *args, **kwargs): |
no test coverage detected