diff --git a/doc/api/next_api_changes/removals/26910-JP.rst b/doc/api/next_api_changes/removals/26910-JP.rst new file mode 100644 index 000000000000..0de12cd89ad5 --- /dev/null +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -0,0 +1,13 @@ +``offsetbox.bbox_artist`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is removed. This was just a wrapper to call `.patches.bbox_artist` if a flag is set in the file, so use that directly if you need the behavior. + +``offsetBox.get_extent_offsets`` and ``offsetBox.get_extent`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... are removed; these methods are also removed on all subclasses of `.OffsetBox`. + +... To get the offsetbox extents, instead of ``get_extent``, use `.OffsetBox.get_bbox`, which directly returns a `.Bbox` instance. + +... To also get the child offsets, instead of ``get_extent_offsets``, separately call `~.OffsetBox.get_offset` on each children after triggering a draw. diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index bb117c38cece..acf93f5a34d9 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -61,12 +61,6 @@ def get_offset(self, *args, **kwargs): return get_offset -@_api.deprecated("3.7", alternative='patches.bbox_artist') -def bbox_artist(*args, **kwargs): - if DEBUG: - mbbox_artist(*args, **kwargs) - - # for debugging use def _bbox_artist(*args, **kwargs): if DEBUG: @@ -366,32 +360,6 @@ def get_bbox(self, renderer): bbox, offsets = self._get_bbox_and_child_offsets(renderer) return bbox - @_api.deprecated("3.7", alternative="get_bbox and child.get_offset") - def get_extent_offsets(self, renderer): - """ - Update offset of the children and return the extent of the box. - - Parameters - ---------- - renderer : `.RendererBase` subclass - - Returns - ------- - width - height - xdescent - ydescent - list of (xoffset, yoffset) pairs - """ - bbox, offsets = self._get_bbox_and_child_offsets(renderer) - return bbox.width, bbox.height, -bbox.x0, -bbox.y0, offsets - - @_api.deprecated("3.7", alternative="get_bbox") - def get_extent(self, renderer): - """Return a tuple ``width, height, xdescent, ydescent`` of the box.""" - bbox = self.get_bbox(renderer) - return bbox.width, bbox.height, -bbox.x0, -bbox.y0 - def get_window_extent(self, renderer=None): # docstring inherited if renderer is None: diff --git a/lib/matplotlib/offsetbox.pyi b/lib/matplotlib/offsetbox.pyi index 7d7f4d8f67ec..09f89aed2bc8 100644 --- a/lib/matplotlib/offsetbox.pyi +++ b/lib/matplotlib/offsetbox.pyi @@ -15,7 +15,6 @@ from typing import Any, Literal, overload DEBUG: bool -def bbox_artist(*args, **kwargs) -> None: ... def _get_packed_offsets( widths: Sequence[float], total: float | None, @@ -51,12 +50,6 @@ class OffsetBox(martist.Artist): def get_visible_children(self) -> list[martist.Artist]: ... def get_children(self) -> list[martist.Artist]: ... def get_bbox(self, renderer: RendererBase) -> Bbox: ... - def get_extent_offsets( - self, renderer: RendererBase - ) -> tuple[float, float, float, float, list[tuple[float, float]]]: ... - def get_extent( - self, renderer: RendererBase - ) -> tuple[float, float, float, float]: ... def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... class PackerBase(OffsetBox):