class_docstr: Base class for all facets
  
  Parameters
  ----------
  scales :
      Whether `x` or `y` scales should be allowed (free)
      to vary according to the data on each of the panel.
  shrink :
      Whether to shrink the scales to the output of the
      statistics instead of the raw data. Default is `True`.
  labeller :
      How to label the facets. A string value if it should be
      one of `["label_value", "label_both", "label_context"]`{.py}.
  as_table :
      If `True`, the facets are laid out like a table with
      the highest values at the bottom-right. If `False`
      the facets are laid out like a plot with the highest
      value a the top-right
  drop :
      If `True`, all factor levels not used in the data
      will automatically be dropped. If `False`, all
      factor levels will be shown, regardless of whether
      or not they appear in the data.
  dir :
      Direction in which to layout the panels. `h` for
      horizontal and `v` for vertical.
class_docstr_tok: ["Base","class","for","all","facets","Parameters","--","--","--","--","--","scales",":","Whether","`","x","`","or","`","y","`","scales","should","be","allowed","(","free",")","to","vary","according","to","the","data","on","each","of","the","panel",".","shrink",":","Whether","to","shrink","the","scales","to","the","output","of","the","statistics","instead","of","the","raw","data",".","Default","is","`","True","`",".","labeller",":","How","to","label","the","facets",".","A","string","value","if","it","should","be","one","of","`","[","``","label_value","''",",","``","label_both","''",",","``","label_context","''","]","`","{",".py","}",".","as_table",":","If","`","True","`",",","the","facets","are","laid","out","like","a","table","with","the","highest","values","at","the","bottom-right",".","If","`","False","`","the","facets","are","laid","out","like","a","plot","with","the","highest","value","a","the","top-right","drop",":","If","`","True","`",",","all","factor","levels","not","used","in","the","data","will","automatically","be","dropped",".","If","`","False","`",",","all","factor","levels","will","be","shown",",","regardless","of","whether","or","not","they","appear","in","the","data",".","dir",":","Direction","in","which","to","layout","the","panels",".","`","h","`","for","horizontal","and","`","v","`","for","vertical","."]
docstr: Create suplots and return axs
docstr_tok: ["Create","suplots","and","return","axs"]
code: def _create_subplots(
      self, fig: Figure, layout: pd.DataFrame
  ) -> list[Axes]:
      """
      Create suplots and return axs
      """
      from matplotlib.gridspec import GridSpec
  
      num_panels = len(layout)
      axsarr = np.empty((self.nrow, self.ncol), dtype=object)
      space = self.space
      default_space: dict[Literal["x", "y"], list[int]] = {
          "x": [1 for x in range(self.ncol)],
          "y": [1 for x in range(self.nrow)],
      }
  
      if isinstance(space, str):
          # TODO: Implement 'free', 'free_x' & 'free_y'
          # This is the value of "fixed" space
          space = default_space
      elif isinstance(space, dict):
          if "x" not in space:
              space["x"] = default_space["x"]
          if "y" not in space:
              space["y"] = default_space["y"]
  
      if len(space["x"]) != self.ncol:
          raise ValueError(
              "The number of x-ratios for the facet space sizes "
              "should match the number of columns."
          )
  
      if len(space["y"]) != self.nrow:
          raise ValueError(
              "The number of y-ratios for the facet space sizes "
              "should match the number of rows."
          )
  
      gs = GridSpec(
          self.nrow,
          self.ncol,
          height_ratios=space["y"],
          width_ratios=space["x"],
      )
      self.grid_spec = gs
  
      # Create axes
      i = 1
      for row in range(self.nrow):
          for col in range(self.ncol):
              axsarr[row, col] = fig.add_subplot(gs[i - 1])
              i += 1
  
      # Rearrange axes
      # They are ordered to match the positions in the layout table
      if self.dir == "h":
          order: Literal["C", "F"] = "C"
          if not self.as_table:
              axsarr = axsarr[::-1]
      elif self.dir == "v":
          order = "F"
          if not self.as_table:
              axsarr = np.array([row[::-1] for row in axsarr])
      else:
          raise ValueError(
              f"Bad value `dir='{self.dir}'` for direction"
          )
  
      axs = axsarr.ravel(order)
  
      # Delete unused axes
      for ax in axs[num_panels:]:
          fig.delaxes(ax)
      axs = axs[:num_panels]
      return list(axs)
  
imports: from __future__ import annotations
  import itertools
  import types
  import typing
  from copy import copy, deepcopy
  import numpy
  import pandas
  import pandas.api.types
  from .._utils import cross_join, match
  from ..exceptions import PlotnineError
  from ..scales.scales import Scales
  from .strips import Strips
label_desc: Use image node_id 14 for calling the facet obj's underlying member method code with example usage: obj._create_subplots(fig, layout) and returns: list