Update the label position based on the bounding box enclosing all the ticklabels and axis spine
(self, renderer)
| 2830 | self.stale = True |
| 2831 | |
| 2832 | def _update_label_position(self, renderer): |
| 2833 | """ |
| 2834 | Update the label position based on the bounding box enclosing |
| 2835 | all the ticklabels and axis spine |
| 2836 | """ |
| 2837 | if not self._autolabelpos: |
| 2838 | return |
| 2839 | |
| 2840 | # get bounding boxes for this axis and any siblings |
| 2841 | # that have been set by `fig.align_ylabels()` |
| 2842 | bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer) |
| 2843 | x, y = self.label.get_position() |
| 2844 | |
| 2845 | if self.label_position == 'left': |
| 2846 | # Union with extents of the left spine if present, of the axes otherwise. |
| 2847 | bbox = mtransforms.Bbox.union([ |
| 2848 | *bboxes, self.axes.spines.get("left", self.axes).get_window_extent()]) |
| 2849 | self.label.set_position( |
| 2850 | (bbox.x0 - self.labelpad * self.get_figure(root=True).dpi / 72, y)) |
| 2851 | else: |
| 2852 | # Union with extents of the right spine if present, of the axes otherwise. |
| 2853 | bbox = mtransforms.Bbox.union([ |
| 2854 | *bboxes2, self.axes.spines.get("right", self.axes).get_window_extent()]) |
| 2855 | self.label.set_position( |
| 2856 | (bbox.x1 + self.labelpad * self.get_figure(root=True).dpi / 72, y)) |
| 2857 | |
| 2858 | def _update_offset_text_position(self, bboxes, bboxes2): |
| 2859 | """ |
nothing calls this directly
no test coverage detected