From f7526ba4ceb4388f5e2f4b64d4d46000a8658485 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Sat, 4 Jun 2022 00:42:32 +0200 Subject: [PATCH] Deprecate empty offsets in get_path_collection_extents --- doc/api/next_api_changes/deprecations/23200-OG.rst | 6 ++++++ lib/matplotlib/path.py | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 doc/api/next_api_changes/deprecations/23200-OG.rst diff --git a/doc/api/next_api_changes/deprecations/23200-OG.rst b/doc/api/next_api_changes/deprecations/23200-OG.rst new file mode 100644 index 000000000000..1b135dc241bb --- /dev/null +++ b/doc/api/next_api_changes/deprecations/23200-OG.rst @@ -0,0 +1,6 @@ +Calling ``paths.get_path_collection_extents`` with empty *offsets* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Calling `~.get_path_collection_extents` with an empty *offsets* parameter +has an ambiguous interpretation and is therefore deprecated. When the +deprecation period expires, this will produce an error. diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index f627533c38e5..d946fa2c3f7c 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -1068,6 +1068,11 @@ def get_path_collection_extents( from .transforms import Bbox if len(paths) == 0: raise ValueError("No paths provided") + if len(offsets) == 0: + _api.warn_deprecated( + "3.8", message="Calling get_path_collection_extents() with an" + " empty offsets list is deprecated since %(since)s. Support will" + " be removed %(removal)s.") extents, minpos = _path.get_path_collection_extents( master_transform, paths, np.atleast_3d(transforms), offsets, offset_transform)