@@ -314,44 +314,51 @@ class in the Matplotlib API, and the one you will be working with most
314314#
315315#
316316# The figure also has its own ``images``, ``lines``, ``patches`` and ``text``
317- # attributes, which you can use to add primitives directly. When doing so, the
318- # default coordinate system for the ``Figure`` will simply be in pixels (which
319- # is not usually what you want). If you instead use Figure-level methods to add
320- # Artists (e.g., using `.Figure.text` to add text), then the default coordinate
321- # system will be "figure coordinates" where (0, 0) is the bottom-left of the
322- # figure and (1, 1) is the top-right of the figure.
323- #
324- # As with all ``Artist``\s, you can control this coordinate system by setting
325- # the transform property. You can explicitly use "figure coordinates" by
326- # setting the ``Artist`` transform to :attr:`!fig.transFigure`:
317+ # attributes, which you can use to access any primitives that are its direct
318+ # children. Artists may be added with the `~.Figure.add_artist` method.
327319
328320import matplotlib .lines as lines
329321
330322fig = plt .figure ()
331323
332- l1 = lines .Line2D ([0 , 1 ], [0 , 1 ], transform = fig .transFigure , figure = fig )
333- l2 = lines .Line2D ([0 , 1 ], [1 , 0 ], transform = fig .transFigure , figure = fig )
334- fig .lines .extend ([l1 , l2 ])
324+ line1 = lines .Line2D ([0 , 1 ], [0 , 1 ])
325+ line2 = lines .Line2D ([0 , 1 ], [1 , 0 ])
326+ for line in line1 , line2 :
327+ fig .add_artist (line )
335328
336329plt .show ()
337330
331+ # %%
332+ #
333+ # As a convenience for images and text, the helper methods `~.Figure.figimage` and
334+ # `~.Figure.text` create the respective Artists and internally add them to the figure.
335+ #
336+ # As with all ``Artist``\s, you can control the coordinate system by setting
337+ # the transform property (see :ref:`transforms_tutorial`). When using
338+ # `~.Figure.figimage`, the default coordinate system is simply pixels. When
339+ # using `~.Figure.text` or `~.Figure.add_artist`, the default coordinate system
340+ # will be "figure coordinates" where (0, 0) is the bottom-left of the figure
341+ # and (1, 1) is the top-right of the figure.
342+ #
338343# %%
339344# Here is a summary of the Artists the Figure contains
340345#
341346# ================ ============================================================
342347# Figure attribute Description
343348# ================ ============================================================
344349# axes A list of `~.axes.Axes` instances
350+ # subfigures A list of `.SubFigure` instances
345351# patch The `.Rectangle` background
346- # images A list of `.FigureImage` patches -
352+ # images An `~.artist.ArtistList` of `.FigureImage` patches -
347353# useful for raw pixel display
348- # legends A list of Figure `.Legend` instances
354+ # legends An `~.artist.ArtistList` of Figure `.Legend` instances
349355# (different from ``Axes.get_legend()``)
350- # lines A list of Figure `.Line2D` instances
356+ # lines An `~.artist.ArtistList` of Figure `.Line2D` instances
351357# (rarely used, see ``Axes.lines``)
352- # patches A list of Figure `.Patch`\s
358+ # patches An `~.artist.ArtistList` of Figure `.Patch`\s
353359# (rarely used, see ``Axes.patches``)
354- # texts A list Figure `.Text` instances
360+ # texts An `~.artist.ArtistList` of Figure `.Text` instances
361+ # artists An `~.artist.ArtistList` of all other `.Artist` instances
355362# ================ ============================================================
356363#
357364# .. _axes-container:
0 commit comments