From a9c3dae0a4551005cf6241e0addd2ca86c6490a7 Mon Sep 17 00:00:00 2001 From: jpgianfaldoni Date: Mon, 25 Sep 2023 08:39:01 -0300 Subject: [PATCH 1/8] Removed the deprecated code from offsetbox.py --- lib/matplotlib/offsetbox.py | 31 +------------------------------ lib/matplotlib/offsetbox.pyi | 7 ------- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index bb117c38cece..b92a6d71f9bf 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -61,10 +61,7 @@ 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 @@ -366,32 +363,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): From 6398fcca7cb08c28ae48995d33edd9a4984dfdad Mon Sep 17 00:00:00 2001 From: jpgianfaldoni Date: Mon, 25 Sep 2023 08:48:07 -0300 Subject: [PATCH 2/8] fix spacing --- lib/matplotlib/offsetbox.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index b92a6d71f9bf..acf93f5a34d9 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -61,9 +61,6 @@ def get_offset(self, *args, **kwargs): return get_offset - - - # for debugging use def _bbox_artist(*args, **kwargs): if DEBUG: From a1224ca57b78f0d1d985a6743ebdf2baa1bb708f Mon Sep 17 00:00:00 2001 From: jpgianfaldoni Date: Mon, 25 Sep 2023 08:49:52 -0300 Subject: [PATCH 3/8] add rst file --- doc/api/next_api_changes/removals/26910-JP.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/api/next_api_changes/removals/26910-JP.rst 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..2f3c24a37ff7 --- /dev/null +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -0,0 +1,9 @@ +``bbox_artist`` +~~~~~~~~~~ +... of `matplotlib.offsetbox` is removed without replacements. +``get_extent_offsets`` +~~~~~~~~~~~~~~ +... of `matplotlib.offsetbox` is removed without replacements. +``get_extent`` +~~~~~~~~~~~~~~ +... of `matplotlib.offsetbox` is removed without replacements. From c56ae3802fce5db9083462e1ce79e0bbe2c4f687 Mon Sep 17 00:00:00 2001 From: jpgianfaldoni Date: Mon, 25 Sep 2023 08:53:34 -0300 Subject: [PATCH 4/8] fix title underline --- doc/api/next_api_changes/removals/26910-JP.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/next_api_changes/removals/26910-JP.rst b/doc/api/next_api_changes/removals/26910-JP.rst index 2f3c24a37ff7..7ddbecb1f26b 100644 --- a/doc/api/next_api_changes/removals/26910-JP.rst +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -1,9 +1,10 @@ ``bbox_artist`` -~~~~~~~~~~ +~~~~~~~~~~~~~~~~ ... of `matplotlib.offsetbox` is removed without replacements. ``get_extent_offsets`` -~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~ + ... of `matplotlib.offsetbox` is removed without replacements. ``get_extent`` -~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~ ... of `matplotlib.offsetbox` is removed without replacements. From f46584d73b862b8ad7ae544448a481fd47293c66 Mon Sep 17 00:00:00 2001 From: jpgianfaldoni Date: Mon, 25 Sep 2023 14:36:27 -0300 Subject: [PATCH 5/8] fix rst file --- .../next_api_changes/removals/26910-JP.rst | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/api/next_api_changes/removals/26910-JP.rst b/doc/api/next_api_changes/removals/26910-JP.rst index 7ddbecb1f26b..4ae96a6de6ec 100644 --- a/doc/api/next_api_changes/removals/26910-JP.rst +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -1,10 +1,13 @@ -``bbox_artist`` -~~~~~~~~~~~~~~~~ -... of `matplotlib.offsetbox` is removed without replacements. -``get_extent_offsets`` -~~~~~~~~~~~~~~~~~~~~~~~ - -... of `matplotlib.offsetbox` is removed without replacements. -``get_extent`` -~~~~~~~~~~~~~~~ -... of `matplotlib.offsetbox` is removed without replacements. +``offsetbox.bbox_artist`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is removed. This is just a wrapper to call `.patches.bbox_artist` if aflag 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 deprecated 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. From 1aaf48920078ca7e81a34463b46bd0b61ea72e17 Mon Sep 17 00:00:00 2001 From: jpgianfaldoni Date: Mon, 25 Sep 2023 14:37:17 -0300 Subject: [PATCH 6/8] make lowercase --- doc/api/next_api_changes/removals/26910-JP.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/next_api_changes/removals/26910-JP.rst b/doc/api/next_api_changes/removals/26910-JP.rst index 4ae96a6de6ec..dc305a47d5ee 100644 --- a/doc/api/next_api_changes/removals/26910-JP.rst +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -3,7 +3,7 @@ ... is removed. This is just a wrapper to call `.patches.bbox_artist` if aflag is set in the file, so use that directly if you need the behavior. -``OffsetBox.get_extent_offsets`` and ``OffsetBox.get_extent`` +``offsetBox.get_extent_offsets`` and ``offsetBox.get_extent`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... are removed; these methods are also deprecated on all subclasses of `.OffsetBox`. From 4de81d6a1caa7319d0dc4c3dd40d31a19b2bad73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Andrade?= <49215007+jpgianfaldoni@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:43:38 -0300 Subject: [PATCH 7/8] Update doc/api/next_api_changes/removals/26910-JP.rst Co-authored-by: Kyle Sunden --- doc/api/next_api_changes/removals/26910-JP.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/next_api_changes/removals/26910-JP.rst b/doc/api/next_api_changes/removals/26910-JP.rst index dc305a47d5ee..b4782d8711fa 100644 --- a/doc/api/next_api_changes/removals/26910-JP.rst +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -6,7 +6,7 @@ ``offsetBox.get_extent_offsets`` and ``offsetBox.get_extent`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -... are removed; these methods are also deprecated on all subclasses of `.OffsetBox`. +... 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. From 93f9e3af996b3f9676feb6de0a352e903bcc2675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Andrade?= <49215007+jpgianfaldoni@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:33:37 -0300 Subject: [PATCH 8/8] Update doc/api/next_api_changes/removals/26910-JP.rst Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com> --- doc/api/next_api_changes/removals/26910-JP.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/next_api_changes/removals/26910-JP.rst b/doc/api/next_api_changes/removals/26910-JP.rst index b4782d8711fa..0de12cd89ad5 100644 --- a/doc/api/next_api_changes/removals/26910-JP.rst +++ b/doc/api/next_api_changes/removals/26910-JP.rst @@ -1,7 +1,7 @@ ``offsetbox.bbox_artist`` ~~~~~~~~~~~~~~~~~~~~~~~~~ -... is removed. This is just a wrapper to call `.patches.bbox_artist` if aflag is set in the file, so use that directly if you need the behavior. +... 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`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~