@@ -1040,7 +1040,7 @@ def subplot(*args, **kwargs):
1040
1040
def subplots (nrows = 1 , ncols = 1 , sharex = False , sharey = False , squeeze = True ,
1041
1041
subplot_kw = None , gridspec_kw = None , ** fig_kw ):
1042
1042
"""
1043
- Create a figure with a set of subplots already made.
1043
+ Create a figure and a set of subplots
1044
1044
1045
1045
This utility wrapper makes it convenient to create common layouts of
1046
1046
subplots, including the enclosing figure object, in a single call.
@@ -1054,30 +1054,30 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1054
1054
Number of columns of the subplot grid.
1055
1055
1056
1056
sharex : bool or string, optional, default: False
1057
- - If True, the X axis will be shared amongst all subplots. Note that
1058
- if nrows > 1 then the x tick labels won't be displayed on any of
1059
- plots but the ones on the bottom row.
1057
+ - If True, the X axis will be shared amongst all subplots.
1060
1058
- If False, no axis will be shared amongst subplots.
1061
1059
- If a string must be one of "row", "col", "all", or "none".
1062
1060
- "all" has the same effect as True.
1063
1061
- "none" has the same effect as False.
1064
1062
- If "row", each subplot row will share a X axis.
1065
- - If "col", each subplot column will share a X axis. Note that if
1066
- nrows > 1 then the x tick labels won't be displayed on any of
1067
- the plots but the ones on the bottom row.
1063
+ - If "col", each subplot column will share a X axis.
1064
+
1065
+ Note that if the x-axis is shared across rows (sharex=True or
1066
+ sharex="col") and nrows > 1 then the x tick labels won't be displayed
1067
+ on any of plots but the ones on the bottom row.
1068
1068
1069
1069
sharey : bool or string, optional, default: False
1070
- - If True, the Y axis will be shared amongst all subplots. Note that
1071
- if ncols > 1 then the y tick labels won't be displayed on any of
1072
- plots but the ones on first column.
1070
+ - If True, the Y axis will be shared amongst all subplots.
1073
1071
- If False, no y-axis will be shared amongst subplots.
1074
1072
- If a string must be one of "row", "col", "all", or "none".
1075
1073
- "all" has the same effect as True.
1076
1074
- "none" has the same effect as False.
1077
1075
- If "row", each subplot row will share a y-axis.
1078
- - If "col", each subplot column will share a y-axis. Note that if
1079
- ncols > 1 then the y tick labels won't be displayed on any of
1080
- the plots but the ones on the first column.
1076
+ - If "col", each subplot column will share a y-axis
1077
+
1078
+ Note that if the y-axis is shared across columns (sharey=False or
1079
+ sharey="col") and ncols > 1 then the y tick labels won't be displayed
1080
+ on any of the plots but the ones on the first column.
1081
1081
1082
1082
squeeze : bool, optional, default: True
1083
1083
- If True, extra dimensions are squeezed out from the returned axis
@@ -1111,10 +1111,12 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1111
1111
-------
1112
1112
fig : :class:`matplotlib.figure.Figure` object
1113
1113
1114
- ax : axis or array of axis objects.
1115
- ax can be either a single axis object or an array of axis objects if
1116
- more than one subplot was created. The dimensions of the resulting
1117
- array can be controlled with the squeeze keyword, see above.
1114
+ ax : Axes object or array of Axes objects.
1115
+
1116
+ ax can be either a single :class:`matplotlib.axes.Axes` object or an
1117
+ array of Axes objects if more than one subplot was created. The
1118
+ dimensions of the resulting array can be controlled with the squeeze
1119
+ keyword, see above.
1118
1120
1119
1121
Examples
1120
1122
--------
@@ -1123,7 +1125,7 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1123
1125
>>> x = np.linspace(0, 2*np.pi, 400)
1124
1126
>>> y = np.sin(x**2)
1125
1127
1126
- Creates just a figure and only one subplot.
1128
+ Creates just a figure and only one subplot
1127
1129
1128
1130
>>> fig, ax = plt.subplots()
1129
1131
>>> ax.plot(x, y)
@@ -1150,13 +1152,18 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
1150
1152
1151
1153
>>> plt.subplots(2, 2, sharey='row')
1152
1154
1153
- Share a X and Y axis with all subplots
1155
+ Share both X and Y axes with all subplots
1154
1156
1155
1157
>>> plt.subplots(2, 2, sharex='all', sharey='all')
1156
1158
1157
1159
Note that this is the same as
1158
1160
1159
1161
>>> plt.subplots(2, 2, sharex=True, sharey=True)
1162
+
1163
+ See Also
1164
+ --------
1165
+ figure
1166
+ subplot
1160
1167
"""
1161
1168
fig = figure (** fig_kw )
1162
1169
axs = fig .subplots (nrows = nrows , ncols = ncols , sharex = sharex , sharey = sharey ,
0 commit comments