Create a figure and a set of subplots. This utility wrapper makes it convenient to create common layouts of subplots, including the enclosing figure object, in a single call. Parameters ---------- nrows, ncols : int, optional, default: 1 Number of rows/columns of t
(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
subplot_kw=None, gridspec_kw=None, **fig_kw)
| 1096 | |
| 1097 | |
| 1098 | def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, |
| 1099 | subplot_kw=None, gridspec_kw=None, **fig_kw): |
| 1100 | """ |
| 1101 | Create a figure and a set of subplots. |
| 1102 | |
| 1103 | This utility wrapper makes it convenient to create common layouts of |
| 1104 | subplots, including the enclosing figure object, in a single call. |
| 1105 | |
| 1106 | Parameters |
| 1107 | ---------- |
| 1108 | nrows, ncols : int, optional, default: 1 |
| 1109 | Number of rows/columns of the subplot grid. |
| 1110 | |
| 1111 | sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False |
| 1112 | Controls sharing of properties among x (`sharex`) or y (`sharey`) |
| 1113 | axes: |
| 1114 | |
| 1115 | - True or 'all': x- or y-axis will be shared among all |
| 1116 | subplots. |
| 1117 | - False or 'none': each subplot x- or y-axis will be |
| 1118 | independent. |
| 1119 | - 'row': each subplot row will share an x- or y-axis. |
| 1120 | - 'col': each subplot column will share an x- or y-axis. |
| 1121 | |
| 1122 | When subplots have a shared x-axis along a column, only the x tick |
| 1123 | labels of the bottom subplot are created. Similarly, when subplots |
| 1124 | have a shared y-axis along a row, only the y tick labels of the first |
| 1125 | column subplot are created. To later turn other subplots' ticklabels |
| 1126 | on, use `~matplotlib.axes.Axes.tick_params`. |
| 1127 | |
| 1128 | squeeze : bool, optional, default: True |
| 1129 | - If True, extra dimensions are squeezed out from the returned |
| 1130 | array of `~matplotlib.axes.Axes`: |
| 1131 | |
| 1132 | - if only one subplot is constructed (nrows=ncols=1), the |
| 1133 | resulting single Axes object is returned as a scalar. |
| 1134 | - for Nx1 or 1xM subplots, the returned object is a 1D numpy |
| 1135 | object array of Axes objects. |
| 1136 | - for NxM, subplots with N>1 and M>1 are returned as a 2D array. |
| 1137 | |
| 1138 | - If False, no squeezing at all is done: the returned Axes object is |
| 1139 | always a 2D array containing Axes instances, even if it ends up |
| 1140 | being 1x1. |
| 1141 | |
| 1142 | num : integer or string, optional, default: None |
| 1143 | A `.pyplot.figure` keyword that sets the figure number or label. |
| 1144 | |
| 1145 | subplot_kw : dict, optional |
| 1146 | Dict with keywords passed to the |
| 1147 | `~matplotlib.figure.Figure.add_subplot` call used to create each |
| 1148 | subplot. |
| 1149 | |
| 1150 | gridspec_kw : dict, optional |
| 1151 | Dict with keywords passed to the `~matplotlib.gridspec.GridSpec` |
| 1152 | constructor used to create the grid the subplots are placed on. |
| 1153 | |
| 1154 | **fig_kw : |
| 1155 | All additional keyword arguments are passed to the |