MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / _do_cell_alignment

Method _do_cell_alignment

site-packages/matplotlib/table.py:390–420  ·  view source on GitHub ↗

Calculate row heights and column widths. Position cells accordingly.

(self)

Source from the content-addressed store, hash-verified

388 return Bbox.union(boxes)
389
390 def _do_cell_alignment(self):
391 """ Calculate row heights and column widths.
392
393 Position cells accordingly.
394 """
395 # Calculate row/column widths
396 widths = {}
397 heights = {}
398 for (row, col), cell in self._cells.items():
399 height = heights.setdefault(row, 0.0)
400 heights[row] = max(height, cell.get_height())
401 width = widths.setdefault(col, 0.0)
402 widths[col] = max(width, cell.get_width())
403
404 # work out left position for each column
405 xpos = 0
406 lefts = {}
407 for col in sorted(widths):
408 lefts[col] = xpos
409 xpos += widths[col]
410
411 ypos = 0
412 bottoms = {}
413 for row in sorted(heights, reverse=True):
414 bottoms[row] = ypos
415 ypos += heights[row]
416
417 # set cell positions
418 for (row, col), cell in self._cells.items():
419 cell.set_x(lefts[col])
420 cell.set_y(bottoms[row])
421
422 def auto_set_column_width(self, col):
423 """ Given column indexs in either List, Tuple or int. Will be able to

Callers 1

_update_positionsMethod · 0.95

Calls 7

maxFunction · 0.85
itemsMethod · 0.45
setdefaultMethod · 0.45
get_heightMethod · 0.45
get_widthMethod · 0.45
set_xMethod · 0.45
set_yMethod · 0.45

Tested by

no test coverage detected