@@ -426,43 +426,46 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
426
426
`num`.
427
427
428
428
figsize : tuple of integers, optional, default: None
429
- width, height in inches. If not provided, defaults to rc
430
- figure.figsize.
429
+ width, height in inches. If not provided, defaults to
430
+ :rc:` figure.figsize` = ``[6.4, 4.8]`` .
431
431
432
432
dpi : integer, optional, default: None
433
- resolution of the figure. If not provided, defaults to rc figure.dpi.
433
+ resolution of the figure. If not provided, defaults to
434
+ :rc:`figure.dpi` = ``100``.
434
435
435
436
facecolor :
436
- the background color. If not provided, defaults to rc figure.facecolor.
437
+ the background color. If not provided, defaults to
438
+ :rc:`figure.facecolor` = ``'w'``.
437
439
438
440
edgecolor :
439
- the border color. If not provided, defaults to rc figure.edgecolor.
441
+ the border color. If not provided, defaults to
442
+ :rc:`figure.edgecolor` = ``'w'``.
440
443
441
444
frameon : bool, optional, default: True
442
445
If False, suppress drawing the figure frame.
443
446
444
- FigureClass : class derived from matplotlib.figure.Figure
445
- Optionally use a custom Figure instance.
447
+ FigureClass : subclass of `~ matplotlib.figure.Figure`
448
+ Optionally use a custom `. Figure` instance.
446
449
447
450
clear : bool, optional, default: False
448
451
If True and the figure already exists, then it is cleared.
449
452
450
453
Returns
451
454
-------
452
- figure : Figure
453
- The Figure instance returned will also be passed to new_figure_manager
454
- in the backends, which allows to hook custom Figure classes into the
455
- pylab interface. Additional kwargs will be passed to the figure init
456
- function.
455
+ figure : `~matplotlib.figure. Figure`
456
+ The `. Figure` instance returned will also be passed to new_figure_manager
457
+ in the backends, which allows to hook custom `. Figure` classes into the
458
+ pyplot interface. Additional kwargs will be passed to the `.Figure`
459
+ init function.
457
460
458
461
Notes
459
462
-----
460
- If you are creating many figures, make sure you explicitly call "close"
461
- on the figures you are not using, because this will enable pylab
462
- to properly clean up the memory.
463
+ If you are creating many figures, make sure you explicitly call
464
+ :func:`.pyplot.close` on the figures you are not using, because this will
465
+ enable pyplot to properly clean up the memory.
463
466
464
- rcParams defines the default values, which can be modified in the
465
- matplotlibrc file.
467
+ `~matplotlib. rcParams` defines the default values, which can be modified
468
+ in the matplotlibrc file.
466
469
"""
467
470
468
471
if figsize is None :
@@ -1020,7 +1023,7 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1020
1023
1021
1024
squeeze : bool, optional, default: True
1022
1025
- If True, extra dimensions are squeezed out from the returned
1023
- array of Axes:
1026
+ array of `~matplotlib.axes. Axes` :
1024
1027
1025
1028
- if only one subplot is constructed (nrows=ncols=1), the
1026
1029
resulting single Axes object is returned as a scalar.
@@ -1038,20 +1041,19 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1038
1041
subplot.
1039
1042
1040
1043
gridspec_kw : dict, optional
1041
- Dict with keywords passed to the
1042
- :class:`~matplotlib.gridspec.GridSpec` constructor used to create the
1043
- grid the subplots are placed on.
1044
+ Dict with keywords passed to the `~matplotlib.gridspec.GridSpec`
1045
+ constructor used to create the grid the subplots are placed on.
1044
1046
1045
1047
**fig_kw :
1046
- All additional keyword arguments are passed to the :func:`figure` call.
1048
+ All additional keyword arguments are passed to the
1049
+ :func:`.pyplot.figure` call.
1047
1050
1048
1051
Returns
1049
1052
-------
1050
- fig : :class:` matplotlib.figure.Figure` object
1053
+ fig : `~ matplotlib.figure.Figure`
1051
1054
1052
1055
ax : Axes object or array of Axes objects.
1053
-
1054
- ax can be either a single :class:`matplotlib.axes.Axes` object or an
1056
+ *ax* can be either a single `~matplotlib.axes.Axes` object or an
1055
1057
array of Axes objects if more than one subplot was created. The
1056
1058
dimensions of the resulting array can be controlled with the squeeze
1057
1059
keyword, see above.
@@ -1098,10 +1100,17 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1098
1100
1099
1101
>>> plt.subplots(2, 2, sharex=True, sharey=True)
1100
1102
1103
+ Creates figure number 10 with a single subplot
1104
+ and clears it if it already exists.
1105
+
1106
+ >>> fig, ax=plt.subplots(num=10, clear=True)
1107
+
1101
1108
See Also
1102
1109
--------
1103
- figure
1104
- subplot
1110
+ :func:`.pyplot.figure`
1111
+ :func:`.pyplot.subplot`
1112
+ :meth:`.Figure.add_subplot`
1113
+ :meth:`.Figure.subplots`
1105
1114
"""
1106
1115
fig = figure (** fig_kw )
1107
1116
axs = fig .subplots (nrows = nrows , ncols = ncols , sharex = sharex , sharey = sharey ,
0 commit comments