Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d2abe7

Browse files
authored
Merge pull request #24664 from oscargus/deprecateinoffsetbox
Deprecate offsetbox.bbox_artist
2 parents a5f5af3 + 9d22d28 commit 1d2abe7

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``offsetbox.bbox_artist``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is deprecated. This is just a wrapper to call `.patches.bbox_artist` if a
5+
flag is set in the file, so use that directly if you need the behavior.

lib/matplotlib/offsetbox.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,18 @@
4040
DEBUG = False
4141

4242

43-
# for debugging use
43+
@_api.deprecated("3.7", alternative='patches.bbox_artist')
4444
def bbox_artist(*args, **kwargs):
4545
if DEBUG:
4646
mbbox_artist(*args, **kwargs)
4747

4848

49+
# for debugging use
50+
def _bbox_artist(*args, **kwargs):
51+
if DEBUG:
52+
mbbox_artist(*args, **kwargs)
53+
54+
4955
def _get_packed_offsets(widths, total, sep, mode="fixed"):
5056
r"""
5157
Pack boxes specified by their *widths*.
@@ -364,7 +370,7 @@ def draw(self, renderer):
364370
for c, (ox, oy) in zip(self.get_visible_children(), offsets):
365371
c.set_offset((px + ox, py + oy))
366372
c.draw(renderer)
367-
bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
373+
_bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
368374
self.stale = False
369375

370376

@@ -672,7 +678,7 @@ def draw(self, renderer):
672678
c.set_clip_path(tpath)
673679
c.draw(renderer)
674680

675-
bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
681+
_bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
676682
self.stale = False
677683

678684

@@ -794,7 +800,7 @@ def get_extent(self, renderer):
794800
def draw(self, renderer):
795801
# docstring inherited
796802
self._text.draw(renderer)
797-
bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
803+
_bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
798804
self.stale = False
799805

800806

@@ -877,7 +883,7 @@ def draw(self, renderer):
877883
# docstring inherited
878884
for c in self._children:
879885
c.draw(renderer)
880-
bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
886+
_bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
881887
self.stale = False
882888

883889

0 commit comments

Comments
 (0)