@@ -232,38 +232,42 @@ def _normalize(key, size, axis): # Includes last index.
232232
233233class GridSpec (GridSpecBase ):
234234 """
235- Specifies the geometry of the grid that a subplot can be placed in .
235+ A grid layout to place subplots within a figure .
236236
237- The location of grid is determined by similar way as the SubplotParams.
237+ The location of the grid cells is determined in a similar way to
238+ `~.figure.SubplotParams` using *left*, *right*, *top*, *bottom*, *wspace*
239+ and *hspace*.
238240 """
239241 def __init__ (self , nrows , ncols , figure = None ,
240242 left = None , bottom = None , right = None , top = None ,
241243 wspace = None , hspace = None ,
242244 width_ratios = None , height_ratios = None ):
243245 """
244- The number of rows and number of columns of the grid need to be set.
245- Optionally, the subplot layout parameters (e.g., left, right, etc.)
246- can be tuned.
247-
248246 Parameters
249247 ----------
250248 nrows, ncols : int
251249 The number of rows and columns of the grid.
252250
253251 figure : `~.figure.Figure`, optional
252+ Only used for constrained layout to create a proper layoutbox.
254253
255254 left, right, top, bottom : float, optional
256255 Extent of the subplots as a fraction of figure width or height.
257256 Left cannot be larger than right, and bottom cannot be larger than
258- top.
257+ top. If not given, the values will be inferred from a figure or
258+ rcParams when necessary. See also `GridSpec.get_subplot_params`.
259259
260260 wspace : float, optional
261261 The amount of width reserved for space between subplots,
262262 expressed as a fraction of the average axis width.
263+ If not given, the values will be inferred from a figure or
264+ rcParams when necessary. See also `GridSpec.get_subplot_params`.
263265
264266 hspace : float, optional
265267 The amount of height reserved for space between subplots,
266268 expressed as a fraction of the average axis height.
269+ If not given, the values will be inferred from a figure or
270+ rcParams when necessary. See also `GridSpec.get_subplot_params`.
267271
268272 width_ratios : array-like of length *ncols*, optional
269273 Defines the relative widths of the columns. Each column gets a
@@ -275,9 +279,6 @@ def __init__(self, nrows, ncols, figure=None,
275279 relative height of ``height_ratios[i] / sum(height_ratios)``.
276280 If not given, all rows will have the same height.
277281
278- Notes
279- -----
280- See `~.figure.SubplotParams` for descriptions of the layout parameters.
281282 """
282283 self .left = left
283284 self .bottom = bottom
@@ -320,7 +321,12 @@ def __setstate__(self, state):
320321
321322 def update (self , ** kwargs ):
322323 """
323- Update the current values.
324+ Update the subplot parameters of the grid.
325+
326+ Parameters:
327+ ----------
328+ left, right, top, bottom : float, optional
329+ wspace, hspace : float, optional
324330
325331 Values set to None use the rcParams value.
326332 """
@@ -350,8 +356,13 @@ def update(self, **kwargs):
350356
351357 def get_subplot_params (self , figure = None ):
352358 """
353- Return a dictionary of subplot layout parameters. The default
354- parameters are from rcParams unless a figure attribute is set.
359+ Return the `~.SubplotParams` for the GridSpec.
360+
361+ In order of precedence the values are taken from
362+
363+ - non-*None* attributes of the GridSpec
364+ - the provided *figure*
365+ - :rc:`figure.subplot.*`
355366 """
356367 if figure is None :
357368 kw = {k : rcParams ["figure.subplot." + k ] for k in self ._AllowedKeys }
@@ -364,6 +375,12 @@ def get_subplot_params(self, figure=None):
364375 return subplotpars
365376
366377 def locally_modified_subplot_params (self ):
378+ """
379+ Return a list of the names of the subplot parameters explicitly set
380+ in the GridSpec.
381+
382+ This is a subset of the attributes of `.SubplotParams`.
383+ """
367384 return [k for k in self ._AllowedKeys if getattr (self , k )]
368385
369386 def tight_layout (self , figure , renderer = None ,
0 commit comments