Helper function to locate the legend.
(self, width, height, xdescent, ydescent, renderer)
| 746 | _loc = property(_get_loc, _set_loc) |
| 747 | |
| 748 | def _findoffset(self, width, height, xdescent, ydescent, renderer): |
| 749 | """Helper function to locate the legend.""" |
| 750 | |
| 751 | if self._loc == 0: # "best". |
| 752 | x, y = self._find_best_position(width, height, renderer) |
| 753 | elif self._loc in Legend.codes.values(): # Fixed location. |
| 754 | bbox = Bbox.from_bounds(0, 0, width, height) |
| 755 | x, y = self._get_anchored_bbox(self._loc, bbox, |
| 756 | self.get_bbox_to_anchor(), |
| 757 | renderer) |
| 758 | else: # Axes or figure coordinates. |
| 759 | fx, fy = self._loc |
| 760 | bbox = self.get_bbox_to_anchor() |
| 761 | x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy |
| 762 | |
| 763 | return x + xdescent, y + ydescent |
| 764 | |
| 765 | @allow_rasterization |
| 766 | def draw(self, renderer): |
nothing calls this directly
no test coverage detected