class_docstr: Layout of entire plot
class_docstr_tok: ["Layout","of","entire","plot"]
docstr: Create a layout for the panels
  
  The layout is a dataframe that stores all the
  structual information about the panels that will
  make up the plot. The actual layout depends on
  the type of facet.
  
  This method ensures that each layer has a copy of the
  data it needs in `layer.data`. That data is also has
  column `PANEL` that indicates the panel onto which each
  data row/item will be plotted.
docstr_tok: ["Create","a","layout","for","the","panels","The","layout","is","a","dataframe","that","stores","all","the","structual","information","about","the","panels","that","will","make","up","the","plot",".","The","actual","layout","depends","on","the","type","of","facet",".","This","method","ensures","that","each","layer","has","a","copy","of","the","data","it","needs","in","`","layer.data","`",".","That","data","is","also","has","column","`","PANEL","`","that","indicates","the","panel","onto","which","each","data","row\/item","will","be","plotted","."]
code: def setup(self, layers: Layers, plot: Ggplot):
      """
      Create a layout for the panels
  
      The layout is a dataframe that stores all the
      structual information about the panels that will
      make up the plot. The actual layout depends on
      the type of facet.
  
      This method ensures that each layer has a copy of the
      data it needs in `layer.data`. That data is also has
      column `PANEL` that indicates the panel onto which each
      data row/item will be plotted.
      """
      data = [l.data for l in layers]
  
      # setup facets
      self.facet = plot.facet
      self.facet.setup_params(data)
      data = self.facet.setup_data(data)
  
      # setup coords
      self.coord = plot.coordinates
      self.coord.setup_params(data)
      data = self.coord.setup_data(data)
  
      # Generate panel layout
      data = self.facet.setup_data(data)
      self.layout = self.facet.compute_layout(data)
      self.layout = self.coord.setup_layout(self.layout)
      self.check_layout()
  
      # Map the data to the panels
      for layer, ldata in zip(layers, data):
          layer.data = self.facet.map(ldata, self.layout)
  
file_path: plotnine/plotnine/facets/layout.py
imports: from __future__ import annotations
  import typing
  from contextlib import suppress
  import numpy
  from .._utils import match
  from ..exceptions import PlotnineError
  from ..iapi import labels_view, layout_details, pos_scales
label_desc: Use image node_id 1 for calling the Layout obj's underlying member method code with example usage: obj.setup(layers, plot) without return types