Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9792aab

Browse filesBrowse files
committed
Deprecate Bbox.anchored() with no container.
This previously returned a copy of the bbox itself, and was completely unused; let's deprecate this for clarity ("anchoring a bbox to itself" doesn't make much sense anyways).
1 parent 7bc69f2 commit 9792aab
Copy full SHA for 9792aab

File tree

Expand file treeCollapse file tree

2 files changed

+9
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-6
lines changed
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``bbox.anchored()`` with no explicit container
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Not passing a *container* argument to `.BboxBase.anchored` is now deprecated.

‎lib/matplotlib/transforms.py

Copy file name to clipboardExpand all lines: lib/matplotlib/transforms.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,21 +501,21 @@ def anchored(self, c, container=None):
501501
bottom, 1 is right or top), 'C' (center), or a cardinal direction
502502
('SW', southwest, is bottom left, etc.).
503503
container : `Bbox`, optional
504-
The box within which the `Bbox` is positioned; it defaults
505-
to the initial `Bbox`.
504+
The box within which the `Bbox` is positioned.
506505
507506
See Also
508507
--------
509508
.Axes.set_anchor
510509
"""
511510
if container is None:
511+
_api.warn_deprecated(
512+
"3.8", message="Calling anchored() with no container bbox "
513+
"returns a frozen copy of the original bbox and is deprecated "
514+
"since %(since)s.")
512515
container = self
513516
l, b, w, h = container.bounds
514-
if isinstance(c, str):
515-
cx, cy = self.coefs[c]
516-
else:
517-
cx, cy = c
518517
L, B, W, H = self.bounds
518+
cx, cy = self.coefs[c] if isinstance(c, str) else c
519519
return Bbox(self._points +
520520
[(l + cx * (w - W)) - L,
521521
(b + cy * (h - H)) - B])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.