class_docstr: A table of cells.
  
  The table consists of a grid of cells, which are indexed by (row, column).
  
  For a simple table, you'll have a full grid of cells with indices from
  (0, 0) to (num_rows-1, num_cols-1), in which the cell (0, 0) is positioned
  at the top left. However, you can also add cells with negative indices.
  You don't have to add a cell to every grid position, so you can create
  tables that have holes.
  
  *Note*: You'll usually not create an empty table from scratch. Instead use
  `~matplotlib.table.table` to create a table from data.
class_docstr_tok: ["A","table","of","cells",".","The","table","consists","of","a","grid","of","cells",",","which","are","indexed","by","(","row",",","column",")",".","For","a","simple","table",",","you","'ll","have","a","full","grid","of","cells","with","indices","from","(","0",",","0",")","to","(","num_rows-1",",","num_cols-1",")",",","in","which","the","cell","(","0",",","0",")","is","positioned","at","the","top","left",".","However",",","you","can","also","add","cells","with","negative","indices",".","You","do","n't","have","to","add","a","cell","to","every","grid","position",",","so","you","can","create","tables","that","have","holes",".","*","Note","*",":","You","'ll","usually","not","create","an","empty","table","from","scratch",".","Instead","use","`","~matplotlib.table.table","`","to","create","a","table","from","data","."]
docstr: Calculate row heights and column widths; position cells accordingly.
docstr_tok: ["Calculate","row","heights","and","column","widths",";","position","cells","accordingly","."]
code: def _do_cell_alignment(self):
      """
      Calculate row heights and column widths; position cells accordingly.
      """
      # Calculate row/column widths
      widths = {}
      heights = {}
      for (row, col), cell in self._cells.items():
          height = heights.setdefault(row, 0.0)
          heights[row] = max(height, cell.get_height())
          width = widths.setdefault(col, 0.0)
          widths[col] = max(width, cell.get_width())
  
      # work out left position for each column
      xpos = 0
      lefts = {}
      for col in sorted(widths):
          lefts[col] = xpos
          xpos += widths[col]
  
      ypos = 0
      bottoms = {}
      for row in sorted(heights, reverse=True):
          bottoms[row] = ypos
          ypos += heights[row]
  
      # set cell positions
      for (row, col), cell in self._cells.items():
          cell.set_x(lefts[col])
          cell.set_y(bottoms[row])
  
imports: import numpy
  from .None import _api, _docstring
  from .artist import Artist, allow_rasterization
  from .patches import Rectangle
  from .text import Text
  from .transforms import Bbox
  from .path import Path
label_desc: Use image node_id 13 for calling the Table obj's underlying member method code with example usage: obj._do_cell_alignment() without return types