Skip to content

Commit 82ca21c

Browse files
committed
Make some more of figure.py numpydoc
1 parent 8b201e8 commit 82ca21c

File tree

1 file changed

+58
-31
lines changed

1 file changed

+58
-31
lines changed

lib/matplotlib/figure.py

Lines changed: 58 additions & 31 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,10 @@ 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+
Returns
460+
-------
461+
bool
462+
If ``True``, figure uses :meth:`tight_layout` when drawing.
444463
"""
445464
return self._tight
446465

@@ -523,15 +542,23 @@ def contains(self, mouseevent):
523542
"""
524543
Test whether the mouse event occurred on the figure.
525544
526-
Returns True, {}.
545+
Returns
546+
-------
547+
Tuple of ``True``, {}.
527548
"""
528549
if callable(self._contains):
529550
return self._contains(self, mouseevent)
530551
inside = self.bbox.contains(mouseevent.x, mouseevent.y)
531552
return inside, {}
532553

533554
def get_window_extent(self, *args, **kwargs):
534-
'get the figure bounding box in display space; kwargs are void'
555+
''''
556+
Get the figure bounding box in display space; arguments are ignored.
557+
558+
Returns
559+
-------
560+
bbox
561+
'''
535562
return self.bbox
536563

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

0 commit comments

Comments
 (0)