@@ -1002,8 +1002,8 @@ def add_subplot(self, *args, **kwargs):
1002
1002
self .stale = True
1003
1003
return a
1004
1004
1005
- def add_subplots (self , nrows = 1 , ncols = 1 , sharex = False , sharey = False ,
1006
- squeeze = True , subplot_kw = None , gridspec_kw = None ):
1005
+ def subplots (self , nrows = 1 , ncols = 1 , sharex = False , sharey = False ,
1006
+ squeeze = True , subplot_kw = None , gridspec_kw = None ):
1007
1007
"""
1008
1008
Add a set of subplots to this figure.
1009
1009
@@ -1029,10 +1029,10 @@ def add_subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
1029
1029
sharey : {"none", "all", "row", "col"} or bool, default: False
1030
1030
If *False*, or "none", each subplot has its own Y axis.
1031
1031
1032
- If *True*, or "all", all subplots will share an Y axis, and the x
1032
+ If *True*, or "all", all subplots will share an Y axis, and the y
1033
1033
tick labels on all but the first column of plots will be invisible.
1034
1034
1035
- If "row", each subplot row will share an Y axis, and the x tick
1035
+ If "row", each subplot row will share an Y axis, and the y tick
1036
1036
labels on all but the first column of plots will be invisible.
1037
1037
1038
1038
If "col", each subplot column will share an Y axis.
@@ -1049,9 +1049,8 @@ def add_subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
1049
1049
1050
1050
- for NxM subplots with N>1 and M>1 are returned as a 2d array.
1051
1051
1052
- If *False*, no squeezing at all is done: the returned axes object
1053
- is always a 2-d array of Axes instances, even if it ends up being
1054
- 1x1.
1052
+ If *False*, no squeezing at all is done: the returned object is
1053
+ always a 2-d array of Axes instances, even if it ends up being 1x1.
1055
1054
1056
1055
subplot_kw : dict, default: {}
1057
1056
Dict with keywords passed to the
@@ -1066,7 +1065,7 @@ def add_subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
1066
1065
Returns
1067
1066
-------
1068
1067
ax : single Axes object or array of Axes objects
1069
- The addes axes. The dimensions of the resulting array can be
1068
+ The added axes. The dimensions of the resulting array can be
1070
1069
controlled with the squeeze keyword, see above.
1071
1070
1072
1071
See Also
@@ -1114,30 +1113,27 @@ def add_subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
1114
1113
axarr [row , col ] = self .add_subplot (gs [row , col ], ** subplot_kw )
1115
1114
1116
1115
# turn off redundant tick labeling
1117
- if sharex in ["col" , "all" ] and nrows > 1 :
1116
+ if sharex in ["col" , "all" ]:
1118
1117
# turn off all but the bottom row
1119
1118
for ax in axarr [:- 1 , :].flat :
1120
1119
for label in ax .get_xticklabels ():
1121
1120
label .set_visible (False )
1122
1121
ax .xaxis .offsetText .set_visible (False )
1123
-
1124
- if sharey in ["row" , "all" ] and ncols > 1 :
1122
+ if sharey in ["row" , "all" ]:
1125
1123
# turn off all but the first column
1126
1124
for ax in axarr [:, 1 :].flat :
1127
1125
for label in ax .get_yticklabels ():
1128
1126
label .set_visible (False )
1129
1127
ax .yaxis .offsetText .set_visible (False )
1130
1128
1131
1129
if squeeze :
1132
- # Reshape the array to have the final desired dimension (nrow,ncol),
1133
- # though discarding unneeded dimensions that equal 1. If we only have
1134
- # one subplot, just return it instead of a 1-element array.
1130
+ # Discarding unneeded dimensions that equal 1. If we only have one
1131
+ # subplot, just return it instead of a 1-element array.
1135
1132
return axarr .item () if axarr .size == 1 else axarr .squeeze ()
1136
1133
else :
1137
- # returned axis array will be always 2-d, even if nrows=ncols=1
1134
+ # Returned axis array will be always 2-d, even if nrows=ncols=1.
1138
1135
return axarr
1139
1136
1140
-
1141
1137
def clf (self , keep_observers = False ):
1142
1138
"""
1143
1139
Clear the figure.
0 commit comments