Update the label position based on the bounding box enclosing all the ticklabels and axis spine
(self, renderer)
| 2603 | self.stale = True |
| 2604 | |
| 2605 | def _update_label_position(self, renderer): |
| 2606 | """ |
| 2607 | Update the label position based on the bounding box enclosing |
| 2608 | all the ticklabels and axis spine |
| 2609 | """ |
| 2610 | if not self._autolabelpos: |
| 2611 | return |
| 2612 | |
| 2613 | # get bounding boxes for this axis and any siblings |
| 2614 | # that have been set by `fig.align_xlabels()` |
| 2615 | bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer) |
| 2616 | x, y = self.label.get_position() |
| 2617 | |
| 2618 | if self.label_position == 'bottom': |
| 2619 | # Union with extents of the bottom spine if present, of the axes otherwise. |
| 2620 | bbox = mtransforms.Bbox.union([ |
| 2621 | *bboxes, self.axes.spines.get("bottom", self.axes).get_window_extent()]) |
| 2622 | self.label.set_position( |
| 2623 | (x, bbox.y0 - self.labelpad * self.get_figure(root=True).dpi / 72)) |
| 2624 | else: |
| 2625 | # Union with extents of the top spine if present, of the axes otherwise. |
| 2626 | bbox = mtransforms.Bbox.union([ |
| 2627 | *bboxes2, self.axes.spines.get("top", self.axes).get_window_extent()]) |
| 2628 | self.label.set_position( |
| 2629 | (x, bbox.y1 + self.labelpad * self.get_figure(root=True).dpi / 72)) |
| 2630 | |
| 2631 | def _update_offset_text_position(self, bboxes, bboxes2): |
| 2632 | """ |
nothing calls this directly
no test coverage detected