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

Skip to content

Commit 6673184

Browse files
committed
port some figure docstrings to numpydoc
1 parent 66967ab commit 6673184

File tree

1 file changed

+51
-40
lines changed

1 file changed

+51
-40
lines changed

lib/matplotlib/figure.py

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -884,20 +884,20 @@ def add_axes(self, *args, **kwargs):
884884
rect : sequence of float
885885
A 4-length sequence of [left, bottom, width, height] quantities.
886886
887-
projection :
888-
['aitoff' | 'hammer' | 'lambert' | 'mollweide' | \
889-
'polar' | 'rectilinear'], optional
887+
projection : {'aitoff', 'hammer', 'lambert', 'mollweide', \
888+
'polar', 'rectilinear'}, optional
890889
The projection type of the axes.
891890
892891
polar : boolean, optional
893892
If True, equivalent to projection='polar'.
894893
895-
This method also takes the keyword arguments for
896-
:class:`~matplotlib.axes.Axes`.
894+
**kwargs
895+
This method also takes the keyword arguments for
896+
:class:`~.axes.Axes`.
897897
898898
Returns
899-
------
900-
axes : Axes
899+
-------
900+
axes : :class:`~.axes.Axes`
901901
The added axes.
902902
903903
Examples
@@ -987,19 +987,20 @@ def add_subplot(self, *args, **kwargs):
987987
integers are I, J, and K, the subplot is the Ith plot on a
988988
grid with J rows and K columns.
989989
990-
projection : ['aitoff' | 'hammer' | 'lambert' | \
991-
'mollweide' | 'polar' | 'rectilinear'], optional
990+
projection : {'aitoff', 'hammer', 'lambert', 'mollweide', \
991+
'polar', 'rectilinear'}, optional
992992
The projection type of the axes.
993993
994994
polar : boolean, optional
995995
If True, equivalent to projection='polar'.
996996
997-
This method also takes the keyword arguments for
998-
:class:`~matplotlib.axes.Axes`.
997+
**kwargs
998+
This method also takes the keyword arguments for
999+
:class:`~matplotlib.axes.Axes`.
9991000
10001001
Returns
10011002
-------
1002-
axes : Axes
1003+
axes : :class:`~matplotlib.axes.Axes`
10031004
The axes of the subplot.
10041005
10051006
Notes
@@ -1010,6 +1011,8 @@ def add_subplot(self, *args, **kwargs):
10101011
10111012
Examples
10121013
--------
1014+
::
1015+
10131016
fig.add_subplot(111)
10141017
10151018
# equivalent but more general
@@ -1440,22 +1443,22 @@ def legend(self, *args, **kwargs):
14401443
If shadow is activated and framealpha is ``None`` the
14411444
default value is being ignored.
14421445
1443-
facecolor : None or "inherit" or a color spec
1446+
facecolor : None or 'inherit' or a color spec
14441447
Control the legend's background color.
14451448
Default is ``None`` which will take the value from the
14461449
``legend.facecolor`` :data:`rcParam<matplotlib.rcParams>`.
1447-
If ``"inherit"``, it will take the ``axes.facecolor``
1450+
If ``'inherit'``, it will take the ``axes.facecolor``
14481451
:data:`rcParam<matplotlib.rcParams>`.
14491452
1450-
edgecolor : None or "inherit" or a color spec
1453+
edgecolor : None or 'inherit' or a color spec
14511454
Control the legend's background patch edge color.
14521455
Default is ``None`` which will take the value from the
14531456
``legend.edgecolor`` :data:`rcParam<matplotlib.rcParams>`.
1454-
If ``"inherit"``, it will take the ``axes.edgecolor``
1457+
If ``'inherit'``, it will take the ``axes.edgecolor``
14551458
:data:`rcParam<matplotlib.rcParams>`.
14561459
1457-
mode : {"expand", None}
1458-
If `mode` is set to ``"expand"`` the legend will be horizontally
1460+
mode : {'expand', None}
1461+
If `mode` is set to ``'expand'`` the legend will be horizontally
14591462
expanded to fill the axes area (or `bbox_to_anchor` if defines
14601463
the legend's size).
14611464
@@ -1734,9 +1737,10 @@ def savefig(self, fname, **kwargs):
17341737
17351738
The output formats available depend on the backend being used.
17361739
1737-
Arguments:
1740+
Parameters
1741+
----------
17381742
1739-
*fname*:
1743+
fname : str or file-like object
17401744
A string containing a path to a filename, or a Python
17411745
file-like object, or possibly some backend-dependent object
17421746
such as :class:`~matplotlib.backends.backend_pdf.PdfPages`.
@@ -1749,29 +1753,33 @@ def savefig(self, fname, **kwargs):
17491753
If *fname* is not a string, remember to specify *format* to
17501754
ensure that the correct backend is used.
17511755
1752-
Keyword arguments:
1756+
Other Parameters
1757+
----------------
17531758
1754-
*dpi*: [ *None* | ``scalar > 0`` | 'figure']
1759+
dpi : [ *None* | scalar > 0 | 'figure']
17551760
The resolution in dots per inch. If *None* it will default to
17561761
the value ``savefig.dpi`` in the matplotlibrc file. If 'figure'
17571762
it will set the dpi to be the value of the figure.
17581763
1759-
*facecolor*, *edgecolor*:
1760-
the colors of the figure rectangle
1764+
facecolor : color spec or None, optional
1765+
the facecolor of the figure; if None, defaults to savefig.facecolor
17611766
1762-
*orientation*: [ 'landscape' | 'portrait' ]
1767+
edgecolor : color spec or None, optional
1768+
the edgecolor of the figure; if None, defaults to savefig.edgecolor
1769+
1770+
orientation : {'landscape', 'portrait'}
17631771
not supported on all backends; currently only on postscript output
17641772
1765-
*papertype*:
1773+
papertype : str
17661774
One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
17671775
'a10', 'b0' through 'b10'. Only supported for postscript
17681776
output.
17691777
1770-
*format*:
1778+
format : str
17711779
One of the file extensions supported by the active
17721780
backend. Most backends support png, pdf, ps, eps and svg.
17731781
1774-
*transparent*:
1782+
transparent : {True, False}
17751783
If *True*, the axes patches will all be transparent; the
17761784
figure patch will also be transparent unless facecolor
17771785
and/or edgecolor are specified via kwargs.
@@ -1780,21 +1788,21 @@ def savefig(self, fname, **kwargs):
17801788
transparency of these patches will be restored to their
17811789
original values upon exit of this function.
17821790
1783-
*frameon*:
1791+
frameon : {True, False}
17841792
If *True*, the figure patch will be colored, if *False*, the
17851793
figure background will be transparent. If not provided, the
17861794
rcParam 'savefig.frameon' will be used.
17871795
1788-
*bbox_inches*:
1796+
bbox_inches : str or `~matplotlib.transforms.Bbox`, optional
17891797
Bbox in inches. Only the given portion of the figure is
17901798
saved. If 'tight', try to figure out the tight bbox of
1791-
the figure.
1799+
the figure. If None, use savefig.bbox
17921800
1793-
*pad_inches*:
1801+
pad_inches : scalar, optional
17941802
Amount of padding around the figure when bbox_inches is
1795-
'tight'.
1803+
'tight'. If None, use savefig.pad_inches
17961804
1797-
*bbox_extra_artists*:
1805+
bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
17981806
A list of extra artists that will be considered when the
17991807
tight bbox is calculated.
18001808
@@ -1988,17 +1996,20 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
19881996
"""
19891997
Adjust subplot parameters to give specified padding.
19901998
1991-
Parameters:
1999+
Parameters
2000+
----------
19922001
1993-
pad : float
2002+
pad : float
19942003
padding between the figure edge and the edges of subplots,
19952004
as a fraction of the font-size.
1996-
h_pad, w_pad : float
2005+
2006+
h_pad, w_pad : float, optional
19972007
padding (height/width) between edges of adjacent subplots.
19982008
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
2009+
2010+
rect : tuple (left, bottom, right, top), optional
2011+
a rectangle (left, bottom, right, top) in the normalized
2012+
figure coordinate that the whole subplots area (including
20022013
labels) will fit into. Default is (0, 0, 1, 1).
20032014
"""
20042015

0 commit comments

Comments
 (0)