Skip to content

Commit 8491561

Browse files
jpgianfaldoniksundenrcomer
authored
Removed the deprecated code from offsetbox.py (matplotlib#26910)
* Removed the deprecated code from offsetbox.py * fix spacing * add rst file * fix title underline * fix rst file * make lowercase * Update doc/api/next_api_changes/removals/26910-JP.rst Co-authored-by: Kyle Sunden <git@ksunden.space> * Update doc/api/next_api_changes/removals/26910-JP.rst Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com> --------- Co-authored-by: Kyle Sunden <git@ksunden.space> Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
1 parent 6028039 commit 8491561

File tree

3 files changed

+13
-39
lines changed

3 files changed

+13
-39
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
``offsetbox.bbox_artist``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... 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.
5+
6+
``offsetBox.get_extent_offsets`` and ``offsetBox.get_extent``
7+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
9+
... are removed; these methods are also removed on all subclasses of `.OffsetBox`.
10+
11+
... To get the offsetbox extents, instead of ``get_extent``, use `.OffsetBox.get_bbox`, which directly returns a `.Bbox` instance.
12+
13+
... To also get the child offsets, instead of ``get_extent_offsets``, separately call `~.OffsetBox.get_offset` on each children after triggering a draw.

lib/matplotlib/offsetbox.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ def get_offset(self, *args, **kwargs):
6161
return get_offset
6262

6363

64-
@_api.deprecated("3.7", alternative='patches.bbox_artist')
65-
def bbox_artist(*args, **kwargs):
66-
if DEBUG:
67-
mbbox_artist(*args, **kwargs)
68-
69-
7064
# for debugging use
7165
def _bbox_artist(*args, **kwargs):
7266
if DEBUG:
@@ -366,32 +360,6 @@ def get_bbox(self, renderer):
366360
bbox, offsets = self._get_bbox_and_child_offsets(renderer)
367361
return bbox
368362

369-
@_api.deprecated("3.7", alternative="get_bbox and child.get_offset")
370-
def get_extent_offsets(self, renderer):
371-
"""
372-
Update offset of the children and return the extent of the box.
373-
374-
Parameters
375-
----------
376-
renderer : `.RendererBase` subclass
377-
378-
Returns
379-
-------
380-
width
381-
height
382-
xdescent
383-
ydescent
384-
list of (xoffset, yoffset) pairs
385-
"""
386-
bbox, offsets = self._get_bbox_and_child_offsets(renderer)
387-
return bbox.width, bbox.height, -bbox.x0, -bbox.y0, offsets
388-
389-
@_api.deprecated("3.7", alternative="get_bbox")
390-
def get_extent(self, renderer):
391-
"""Return a tuple ``width, height, xdescent, ydescent`` of the box."""
392-
bbox = self.get_bbox(renderer)
393-
return bbox.width, bbox.height, -bbox.x0, -bbox.y0
394-
395363
def get_window_extent(self, renderer=None):
396364
# docstring inherited
397365
if renderer is None:

lib/matplotlib/offsetbox.pyi

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ from typing import Any, Literal, overload
1515

1616
DEBUG: bool
1717

18-
def bbox_artist(*args, **kwargs) -> None: ...
1918
def _get_packed_offsets(
2019
widths: Sequence[float],
2120
total: float | None,
@@ -51,12 +50,6 @@ class OffsetBox(martist.Artist):
5150
def get_visible_children(self) -> list[martist.Artist]: ...
5251
def get_children(self) -> list[martist.Artist]: ...
5352
def get_bbox(self, renderer: RendererBase) -> Bbox: ...
54-
def get_extent_offsets(
55-
self, renderer: RendererBase
56-
) -> tuple[float, float, float, float, list[tuple[float, float]]]: ...
57-
def get_extent(
58-
self, renderer: RendererBase
59-
) -> tuple[float, float, float, float]: ...
6053
def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
6154

6255
class PackerBase(OffsetBox):

0 commit comments

Comments
 (0)