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

Skip to content

Commit 5ec960b

Browse files
authored
Merge pull request #9777 from timhoffm/figure-docstrings
PR: Port Figure docstrings to numpydoc
2 parents c168464 + e231fd5 commit 5ec960b

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

lib/matplotlib/figure.py

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -892,11 +892,12 @@ def add_axes(self, *args, **kwargs):
892892
polar : boolean, optional
893893
If True, equivalent to projection='polar'.
894894
895-
This method also takes the keyword arguments for
896-
:class:`~matplotlib.axes.Axes`.
895+
**kwargs
896+
This method also takes the keyword arguments for
897+
:class:`~matplotlib.axes.Axes`.
897898
898899
Returns
899-
------
900+
-------
900901
axes : Axes
901902
The added axes.
902903
@@ -994,8 +995,9 @@ def add_subplot(self, *args, **kwargs):
994995
polar : boolean, optional
995996
If True, equivalent to projection='polar'.
996997
997-
This method also takes the keyword arguments for
998-
:class:`~matplotlib.axes.Axes`.
998+
**kwargs
999+
This method also takes the keyword arguments for
1000+
:class:`~matplotlib.axes.Axes`.
9991001
10001002
Returns
10011003
-------
@@ -1010,6 +1012,8 @@ def add_subplot(self, *args, **kwargs):
10101012
10111013
Examples
10121014
--------
1015+
::
1016+
10131017
fig.add_subplot(111)
10141018
10151019
# equivalent but more general
@@ -1734,9 +1738,10 @@ def savefig(self, fname, **kwargs):
17341738
17351739
The output formats available depend on the backend being used.
17361740
1737-
Arguments:
1741+
Parameters
1742+
----------
17381743
1739-
*fname*:
1744+
fname : str or file-like object
17401745
A string containing a path to a filename, or a Python
17411746
file-like object, or possibly some backend-dependent object
17421747
such as :class:`~matplotlib.backends.backend_pdf.PdfPages`.
@@ -1749,29 +1754,33 @@ def savefig(self, fname, **kwargs):
17491754
If *fname* is not a string, remember to specify *format* to
17501755
ensure that the correct backend is used.
17511756
1752-
Keyword arguments:
1757+
Other Parameters
1758+
----------------
17531759
1754-
*dpi*: [ *None* | ``scalar > 0`` | 'figure']
1760+
dpi : [ *None* | scalar > 0 | 'figure']
17551761
The resolution in dots per inch. If *None* it will default to
17561762
the value ``savefig.dpi`` in the matplotlibrc file. If 'figure'
17571763
it will set the dpi to be the value of the figure.
17581764
1759-
*facecolor*, *edgecolor*:
1760-
the colors of the figure rectangle
1765+
facecolor : color spec or None, optional
1766+
the facecolor of the figure; if None, defaults to savefig.facecolor
17611767
1762-
*orientation*: [ 'landscape' | 'portrait' ]
1768+
edgecolor : color spec or None, optional
1769+
the edgecolor of the figure; if None, defaults to savefig.edgecolor
1770+
1771+
orientation : {'landscape', 'portrait'}
17631772
not supported on all backends; currently only on postscript output
17641773
1765-
*papertype*:
1774+
papertype : str
17661775
One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
17671776
'a10', 'b0' through 'b10'. Only supported for postscript
17681777
output.
17691778
1770-
*format*:
1779+
format : str
17711780
One of the file extensions supported by the active
17721781
backend. Most backends support png, pdf, ps, eps and svg.
17731782
1774-
*transparent*:
1783+
transparent : bool
17751784
If *True*, the axes patches will all be transparent; the
17761785
figure patch will also be transparent unless facecolor
17771786
and/or edgecolor are specified via kwargs.
@@ -1780,21 +1789,21 @@ def savefig(self, fname, **kwargs):
17801789
transparency of these patches will be restored to their
17811790
original values upon exit of this function.
17821791
1783-
*frameon*:
1792+
frameon : bool
17841793
If *True*, the figure patch will be colored, if *False*, the
17851794
figure background will be transparent. If not provided, the
17861795
rcParam 'savefig.frameon' will be used.
17871796
1788-
*bbox_inches*:
1797+
bbox_inches : str or `~matplotlib.transforms.Bbox`, optional
17891798
Bbox in inches. Only the given portion of the figure is
17901799
saved. If 'tight', try to figure out the tight bbox of
1791-
the figure.
1800+
the figure. If None, use savefig.bbox
17921801
1793-
*pad_inches*:
1802+
pad_inches : scalar, optional
17941803
Amount of padding around the figure when bbox_inches is
1795-
'tight'.
1804+
'tight'. If None, use savefig.pad_inches
17961805
1797-
*bbox_extra_artists*:
1806+
bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
17981807
A list of extra artists that will be considered when the
17991808
tight bbox is calculated.
18001809
@@ -1988,17 +1997,20 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
19881997
"""
19891998
Adjust subplot parameters to give specified padding.
19901999
1991-
Parameters:
2000+
Parameters
2001+
----------
19922002
1993-
pad : float
2003+
pad : float
19942004
padding between the figure edge and the edges of subplots,
19952005
as a fraction of the font-size.
1996-
h_pad, w_pad : float
2006+
2007+
h_pad, w_pad : float, optional
19972008
padding (height/width) between edges of adjacent subplots.
19982009
Defaults to `pad_inches`.
1999-
rect : if rect is given, it is interpreted as a rectangle
2000-
(left, bottom, right, top) in the normalized figure
2001-
coordinate that the whole subplots area (including
2010+
2011+
rect : tuple (left, bottom, right, top), optional
2012+
a rectangle (left, bottom, right, top) in the normalized
2013+
figure coordinate that the whole subplots area (including
20022014
labels) will fit into. Default is (0, 0, 1, 1).
20032015
"""
20042016

0 commit comments

Comments
 (0)