Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df9050f

Browse files
authored
Merge pull request #9684 from dstansby/figure-doc
Make some more of figure.py numpydoc
2 parents e2b73d6 + 5388841 commit df9050f

File tree

1 file changed

+48
-30
lines changed

1 file changed

+48
-30
lines changed

lib/matplotlib/figure.py

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,17 @@ class Figure(Artist):
259259
the callback will be called with ``func(fig)`` where fig is the
260260
:class:`Figure` instance.
261261
262-
*patch*
263-
The figure patch is drawn by a
264-
:class:`matplotlib.patches.Rectangle` instance
265-
266-
*suppressComposite*
267-
For multiple figure images, the figure will make composite
268-
images depending on the renderer option_image_nocomposite
269-
function. If suppressComposite is True|False, this will
270-
override the renderer.
262+
Attributes
263+
----------
264+
patch
265+
The figure patch is drawn by a
266+
:class:`matplotlib.patches.Rectangle` instance
267+
268+
suppressComposite
269+
For multiple figure images, the figure will make composite images
270+
depending on the renderer option_image_nocomposite function.
271+
If *suppressComposite* is ``True`` or ``False``, this will override
272+
the renderer.
271273
"""
272274

273275
def __str__(self):
@@ -284,33 +286,35 @@ def __init__(self,
284286
tight_layout=None, # default to rc figure.autolayout
285287
):
286288
"""
287-
*figsize*
288-
w,h tuple in inches
289+
Parameters
290+
----------
291+
figsize : 2-tuple of floats
292+
``(width, height)`` tuple in inches
289293
290-
*dpi*
294+
dpi : float
291295
Dots per inch
292296
293-
*facecolor*
297+
facecolor
294298
The figure patch facecolor; defaults to rc ``figure.facecolor``
295299
296-
*edgecolor*
300+
edgecolor
297301
The figure patch edge color; defaults to rc ``figure.edgecolor``
298302
299-
*linewidth*
303+
linewidth : float
300304
The figure patch edge linewidth; the default linewidth of the frame
301305
302-
*frameon*
303-
If *False*, suppress drawing the figure frame
306+
frameon : bool
307+
If ``False``, suppress drawing the figure frame
304308
305-
*subplotpars*
306-
A :class:`SubplotParams` instance, defaults to rc
309+
subplotpars : :class:`SubplotParams`
310+
Subplot parameters, defaults to rc
307311
308-
*tight_layout*
309-
If *False* use *subplotpars*; if *True* adjust subplot
312+
tight_layout : bool
313+
If ``False`` use *subplotpars*; if ``True`` adjust subplot
310314
parameters using :meth:`tight_layout` with default padding.
311-
When providing a dict containing the keys `pad`, `w_pad`, `h_pad`
312-
and `rect`, the default :meth:`tight_layout` paddings will be
313-
overridden.
315+
When providing a dict containing the keys
316+
``pad``, ``w_pad``, ``h_pad``, and ``rect``, the default
317+
:meth:`tight_layout` paddings will be overridden.
314318
Defaults to rc ``figure.autolayout``.
315319
"""
316320
Artist.__init__(self)
@@ -382,7 +386,7 @@ def _repr_html_(self):
382386
# We can't use "isinstance" here, because then we'd end up importing
383387
# webagg unconditiionally.
384388
if (self.canvas is not None and
385-
'WebAgg' in self.canvas.__class__.__name__):
389+
'WebAgg' in self.canvas.__class__.__name__):
386390
from matplotlib.backends import backend_webagg
387391
return backend_webagg.ipython_inline_display(self)
388392

@@ -395,8 +399,15 @@ def show(self, warn=True):
395399
:class:`~matplotlib.backend_bases.FigureManagerBase`, and
396400
will raise an AttributeError.
397401
398-
For non-GUI backends, this does nothing, in which case
399-
a warning will be issued if *warn* is True (default).
402+
Parameters
403+
----------
404+
warm : bool
405+
If ``True``, issue warning when called on a non-GUI backend
406+
407+
Notes
408+
-----
409+
For non-GUI backends, this does nothing, in which case a warning will
410+
be issued if *warn* is ``True`` (default).
400411
"""
401412
try:
402413
manager = getattr(self.canvas, 'manager')
@@ -428,7 +439,12 @@ def _get_dpi(self):
428439

429440
def _set_dpi(self, dpi, forward=True):
430441
"""
431-
The forward kwarg is passed on to set_size_inches
442+
Parameters
443+
----------
444+
dpi : float
445+
446+
forward : bool
447+
Passed on to `~.Figure.set_size_inches`
432448
"""
433449
self._dpi = dpi
434450
self.dpi_scale_trans.clear().scale(dpi, dpi)
@@ -440,7 +456,7 @@ def _set_dpi(self, dpi, forward=True):
440456

441457
def get_tight_layout(self):
442458
"""
443-
Return the Boolean flag, True to use :meth:`tight_layout` when drawing.
459+
Return whether the figure uses :meth:`tight_layout` when drawing.
444460
"""
445461
return self._tight
446462

@@ -531,7 +547,9 @@ def contains(self, mouseevent):
531547
return inside, {}
532548

533549
def get_window_extent(self, *args, **kwargs):
534-
'get the figure bounding box in display space; kwargs are void'
550+
''''
551+
Return figure bounding box in display space; arguments are ignored.
552+
'''
535553
return self.bbox
536554

537555
def suptitle(self, t, **kwargs):

0 commit comments

Comments
 (0)