Skip to content

Commit 394447f

Browse files
committed
MNT : fix __init__ order in AnchoredSizeLocator
Trying to set the axes property before calling up the mro to the base class (eventually Artist) `__init__` which means that the `_axes` attribute is not yet attached to the instance object. - removed setting of `self.axes`, this is taken care of in the baseclass - moved rest of sub-class specific attributes to after call up mro stack
1 parent fa87fa7 commit 394447f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,21 @@ def __call__(self, ax, renderer):
5858

5959
return bb
6060

61+
6162
from . import axes_size as Size
6263

6364

6465
class AnchoredSizeLocator(AnchoredLocatorBase):
6566
def __init__(self, bbox_to_anchor, x_size, y_size, loc,
6667
borderpad=0.5, bbox_transform=None):
67-
self.axes = None
68-
self.x_size = Size.from_any(x_size)
69-
self.y_size = Size.from_any(y_size)
7068

7169
super(AnchoredSizeLocator, self).__init__(bbox_to_anchor, None, loc,
7270
borderpad=borderpad,
7371
bbox_transform=bbox_transform)
7472

73+
self.x_size = Size.from_any(x_size)
74+
self.y_size = Size.from_any(y_size)
75+
7576
def get_extent(self, renderer):
7677

7778
x, y, w, h = self.get_bbox_to_anchor().bounds

0 commit comments

Comments
 (0)