MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _update_positions

Method _update_positions

lib/matplotlib/table.py:583–639  ·  view source on GitHub ↗
(self, renderer)

Source from the content-addressed store, hash-verified

581 c.set_y(y + oy)
582
583 def _update_positions(self, renderer):
584 # called from renderer to allow more precise estimates of
585 # widths and heights with get_window_extent
586
587 # Do any auto width setting
588 for col in self._autoColumns:
589 self._auto_set_column_width(col, renderer)
590
591 if self._autoFontsize:
592 self._auto_set_font_size(renderer)
593
594 # Align all the cells
595 self._do_cell_alignment()
596
597 bbox = self._get_grid_bbox(renderer)
598 l, b, w, h = bbox.bounds
599
600 if self._bbox is not None:
601 # Position according to bbox
602 if isinstance(self._bbox, Bbox):
603 rl, rb, rw, rh = self._bbox.bounds
604 else:
605 rl, rb, rw, rh = self._bbox
606 self.scale(rw / w, rh / h)
607 ox = rl - l
608 oy = rb - b
609 self._do_cell_alignment()
610 else:
611 # Position using loc
612 (BEST, UR, UL, LL, LR, CL, CR, LC, UC, C,
613 TR, TL, BL, BR, R, L, T, B) = range(len(self.codes))
614 # defaults for center
615 ox = (0.5 - w / 2) - l
616 oy = (0.5 - h / 2) - b
617 if self._loc in (UL, LL, CL): # left
618 ox = self.AXESPAD - l
619 if self._loc in (BEST, UR, LR, R, CR): # right
620 ox = 1 - (l + w + self.AXESPAD)
621 if self._loc in (BEST, UR, UL, UC): # upper
622 oy = 1 - (b + h + self.AXESPAD)
623 if self._loc in (LL, LR, LC): # lower
624 oy = self.AXESPAD - b
625 if self._loc in (LC, UC, C): # center x
626 ox = (0.5 - w / 2) - l
627 if self._loc in (CL, CR, C): # center y
628 oy = (0.5 - h / 2) - b
629
630 if self._loc in (TL, BL, L): # out left
631 ox = - (l + w)
632 if self._loc in (TR, BR, R): # out right
633 ox = 1.0 - l
634 if self._loc in (TR, TL, T): # out top
635 oy = 1.0 - b
636 if self._loc in (BL, BR, B): # out bottom
637 oy = - (b + h)
638
639 self._offset(ox, oy)
640

Callers 2

drawMethod · 0.95
get_window_extentMethod · 0.95

Calls 6

_auto_set_font_sizeMethod · 0.95
_do_cell_alignmentMethod · 0.95
_get_grid_bboxMethod · 0.95
scaleMethod · 0.95
_offsetMethod · 0.95

Tested by

no test coverage detected