class_docstr: A grid layout to place subplots within a figure.
  
  The location of the grid cells is determined in a similar way to
  `.SubplotParams` using *left*, *right*, *top*, *bottom*, *wspace*
  and *hspace*.
  
  Indexing a GridSpec instance returns a `.SubplotSpec`.
class_docstr_tok: ["A","grid","layout","to","place","subplots","within","a","figure",".","The","location","of","the","grid","cells","is","determined","in","a","similar","way","to","`",".SubplotParams","`","using","*","left","*",",","*","right","*",",","*","top","*",",","*","bottom","*",",","*","wspace","*","and","*","hspace","*",".","Indexing","a","GridSpec","instance","returns","a","`",".SubplotSpec","`","."]
docstr: Parameters
  ----------
  nrows, ncols : int
      The number of rows and columns of the grid.
  
  figure : `.Figure`, optional
      Only used for constrained layout to create a proper layoutgrid.
  
  left, right, top, bottom : float, optional
      Extent of the subplots as a fraction of figure width or height.
      Left cannot be larger than right, and bottom cannot be larger than
      top. If not given, the values will be inferred from a figure or
      rcParams at draw time. See also `GridSpec.get_subplot_params`.
  
  wspace : float, optional
      The amount of width reserved for space between subplots,
      expressed as a fraction of the average axis width.
      If not given, the values will be inferred from a figure or
      rcParams when necessary. See also `GridSpec.get_subplot_params`.
  
  hspace : float, optional
      The amount of height reserved for space between subplots,
      expressed as a fraction of the average axis height.
      If not given, the values will be inferred from a figure or
      rcParams when necessary. See also `GridSpec.get_subplot_params`.
  
  width_ratios : array-like of length *ncols*, optional
      Defines the relative widths of the columns. Each column gets a
      relative width of ``width_ratios[i] / sum(width_ratios)``.
      If not given, all columns will have the same width.
  
  height_ratios : array-like of length *nrows*, optional
      Defines the relative heights of the rows. Each row gets a
      relative height of ``height_ratios[i] / sum(height_ratios)``.
      If not given, all rows will have the same height.
code: def __init__(
      self,
      nrows,
      ncols,
      figure=None,
      left=None,
      bottom=None,
      right=None,
      top=None,
      wspace=None,
      hspace=None,
      width_ratios=None,
      height_ratios=None,
  ):
      """
      Parameters
      ----------
      nrows, ncols : int
          The number of rows and columns of the grid.
  
      figure : `.Figure`, optional
          Only used for constrained layout to create a proper layoutgrid.
  
      left, right, top, bottom : float, optional
          Extent of the subplots as a fraction of figure width or height.
          Left cannot be larger than right, and bottom cannot be larger than
          top. If not given, the values will be inferred from a figure or
          rcParams at draw time. See also `GridSpec.get_subplot_params`.
  
      wspace : float, optional
          The amount of width reserved for space between subplots,
          expressed as a fraction of the average axis width.
          If not given, the values will be inferred from a figure or
          rcParams when necessary. See also `GridSpec.get_subplot_params`.
  
      hspace : float, optional
          The amount of height reserved for space between subplots,
          expressed as a fraction of the average axis height.
          If not given, the values will be inferred from a figure or
          rcParams when necessary. See also `GridSpec.get_subplot_params`.
  
      width_ratios : array-like of length *ncols*, optional
          Defines the relative widths of the columns. Each column gets a
          relative width of ``width_ratios[i] / sum(width_ratios)``.
          If not given, all columns will have the same width.
  
      height_ratios : array-like of length *nrows*, optional
          Defines the relative heights of the rows. Each row gets a
          relative height of ``height_ratios[i] / sum(height_ratios)``.
          If not given, all rows will have the same height.
  
      """
      self.left = left
      self.bottom = bottom
      self.right = right
      self.top = top
      self.wspace = wspace
      self.hspace = hspace
      self.figure = figure
  
      super().__init__(
          nrows,
          ncols,
          width_ratios=width_ratios,
          height_ratios=height_ratios,
      )
  
imports: import copy
  import logging
  from numbers import Integral
  import numpy
  import matplotlib
  from matplotlib import _api, _pylab_helpers, _tight_layout
  from matplotlib.transforms import Bbox
label_desc: Use image node_id 1 to create a new GridSpec object from inherited base classes: GridSpecBase with example: obj = GridSpec(nrows, ncols, figure, left, bottom, right, top, wspace, hspace, width_ratios, height_ratios)