Skip to content

Commit c0c3627

Browse files
authored
Merge pull request matplotlib#22420 from anntzer/figdoc
Update plt.figure() docstring.
2 parents d82a61f + 0e485ac commit c0c3627

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

lib/matplotlib/pyplot.py

+14-22
Original file line numberDiff line numberDiff line change
@@ -712,40 +712,32 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
712712
If False, suppress drawing the figure frame.
713713
714714
FigureClass : subclass of `~matplotlib.figure.Figure`
715-
Optionally use a custom `.Figure` instance.
715+
If set, an instance of this subclass will be created, rather than a
716+
plain `.Figure`.
716717
717718
clear : bool, default: False
718719
If True and the figure already exists, then it is cleared.
719720
720-
tight_layout : bool or dict, default: :rc:`figure.autolayout`
721-
If ``False`` use *subplotpars*. If ``True`` adjust subplot
722-
parameters using `.tight_layout` with default padding.
723-
When providing a dict containing the keys ``pad``, ``w_pad``,
724-
``h_pad``, and ``rect``, the default `.tight_layout` paddings
725-
will be overridden.
721+
layout : {'constrained', 'tight', `.LayoutEngine`, None}, default: None
722+
The layout mechanism for positioning of plot elements to avoid
723+
overlapping Axes decorations (labels, ticks, etc). Note that layout
724+
managers can measurably slow down figure display. Defaults to *None*
725+
(but see the documentation of the `.Figure` constructor regarding the
726+
interaction with rcParams).
726727
727-
constrained_layout : bool, default: :rc:`figure.constrained_layout.use`
728-
If ``True`` use constrained layout to adjust positioning of plot
729-
elements. Like ``tight_layout``, but designed to be more
730-
flexible. See
731-
:doc:`/tutorials/intermediate/constrainedlayout_guide`
732-
for examples. (Note: does not work with `add_subplot` or
733-
`~.pyplot.subplot2grid`.)
734-
735-
736-
**kwargs : optional
737-
See `~.matplotlib.figure.Figure` for other possible arguments.
728+
**kwargs
729+
Additional keyword arguments are passed to the `.Figure` constructor.
738730
739731
Returns
740732
-------
741733
`~matplotlib.figure.Figure`
742-
The `.Figure` instance returned will also be passed to
743-
new_figure_manager in the backends, which allows to hook custom
744-
`.Figure` classes into the pyplot interface. Additional kwargs will be
745-
passed to the `.Figure` init function.
746734
747735
Notes
748736
-----
737+
Newly created figures will be passed to the
738+
`~.backend_template.new_figure_manager` function provided by the current
739+
backend, which will install a canvas and a manager on the figure.
740+
749741
If you are creating many figures, make sure you explicitly call
750742
`.pyplot.close` on the figures you are not using, because this will
751743
enable pyplot to properly clean up the memory.

0 commit comments

Comments
 (0)