diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 4ce27daa86dd..97adf7354d0b 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -259,15 +259,17 @@ class Figure(Artist): the callback will be called with ``func(fig)`` where fig is the :class:`Figure` instance. - *patch* - The figure patch is drawn by a - :class:`matplotlib.patches.Rectangle` instance - - *suppressComposite* - For multiple figure images, the figure will make composite - images depending on the renderer option_image_nocomposite - function. If suppressComposite is True|False, this will - override the renderer. + Attributes + ---------- + patch + The figure patch is drawn by a + :class:`matplotlib.patches.Rectangle` instance + + suppressComposite + For multiple figure images, the figure will make composite images + depending on the renderer option_image_nocomposite function. + If *suppressComposite* is ``True`` or ``False``, this will override + the renderer. """ def __str__(self): @@ -284,33 +286,35 @@ def __init__(self, tight_layout=None, # default to rc figure.autolayout ): """ - *figsize* - w,h tuple in inches + Parameters + ---------- + figsize : 2-tuple of floats + ``(width, height)`` tuple in inches - *dpi* + dpi : float Dots per inch - *facecolor* + facecolor The figure patch facecolor; defaults to rc ``figure.facecolor`` - *edgecolor* + edgecolor The figure patch edge color; defaults to rc ``figure.edgecolor`` - *linewidth* + linewidth : float The figure patch edge linewidth; the default linewidth of the frame - *frameon* - If *False*, suppress drawing the figure frame + frameon : bool + If ``False``, suppress drawing the figure frame - *subplotpars* - A :class:`SubplotParams` instance, defaults to rc + subplotpars : :class:`SubplotParams` + Subplot parameters, defaults to rc - *tight_layout* - If *False* use *subplotpars*; if *True* adjust subplot + tight_layout : bool + If ``False`` use *subplotpars*; if ``True`` adjust subplot parameters using :meth:`tight_layout` with default padding. - When providing a dict containing the keys `pad`, `w_pad`, `h_pad` - and `rect`, the default :meth:`tight_layout` paddings will be - overridden. + When providing a dict containing the keys + ``pad``, ``w_pad``, ``h_pad``, and ``rect``, the default + :meth:`tight_layout` paddings will be overridden. Defaults to rc ``figure.autolayout``. """ Artist.__init__(self) @@ -382,7 +386,7 @@ def _repr_html_(self): # We can't use "isinstance" here, because then we'd end up importing # webagg unconditiionally. if (self.canvas is not None and - 'WebAgg' in self.canvas.__class__.__name__): + 'WebAgg' in self.canvas.__class__.__name__): from matplotlib.backends import backend_webagg return backend_webagg.ipython_inline_display(self) @@ -395,8 +399,15 @@ def show(self, warn=True): :class:`~matplotlib.backend_bases.FigureManagerBase`, and will raise an AttributeError. - For non-GUI backends, this does nothing, in which case - a warning will be issued if *warn* is True (default). + Parameters + ---------- + warm : bool + If ``True``, issue warning when called on a non-GUI backend + + Notes + ----- + For non-GUI backends, this does nothing, in which case a warning will + be issued if *warn* is ``True`` (default). """ try: manager = getattr(self.canvas, 'manager') @@ -428,7 +439,12 @@ def _get_dpi(self): def _set_dpi(self, dpi, forward=True): """ - The forward kwarg is passed on to set_size_inches + Parameters + ---------- + dpi : float + + forward : bool + Passed on to `~.Figure.set_size_inches` """ self._dpi = dpi self.dpi_scale_trans.clear().scale(dpi, dpi) @@ -440,7 +456,7 @@ def _set_dpi(self, dpi, forward=True): def get_tight_layout(self): """ - Return the Boolean flag, True to use :meth:`tight_layout` when drawing. + Return whether the figure uses :meth:`tight_layout` when drawing. """ return self._tight @@ -531,7 +547,9 @@ def contains(self, mouseevent): return inside, {} def get_window_extent(self, *args, **kwargs): - 'get the figure bounding box in display space; kwargs are void' + '''' + Return figure bounding box in display space; arguments are ignored. + ''' return self.bbox def suptitle(self, t, **kwargs):