@@ -665,6 +665,8 @@ def __init__(self, fig,
665
665
self .set_box_aspect (box_aspect )
666
666
self ._axes_locator = None # Optionally set via update(kwargs).
667
667
668
+ self ._children = []
669
+
668
670
# placeholder for any colorbars added that use this Axes.
669
671
# (see colorbar.py):
670
672
self ._colorbars = []
@@ -1078,7 +1080,7 @@ def _update_transScale(self):
1078
1080
self .transScale .set (
1079
1081
mtransforms .blended_transform_factory (
1080
1082
self .xaxis .get_transform (),self .yaxis .get_transform ()))
1081
- for line in getattr ( self , " _children" , []): # Not set during init.
1083
+ for line in self . _children :
1082
1084
if not isinstance (line ,mlines .Line2D ):
1083
1085
continue
1084
1086
try :
@@ -2936,22 +2938,15 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
2936
2938
2937
2939
x_stickies = y_stickies = np .array ([])
2938
2940
if self .use_sticky_edges :
2939
- # Only iterate over Axes and artists if needed. The check for
2940
- # ``hasattr(ax, "_children")`` is necessary because this can be
2941
- # called very early in the Axes init process (e.g., for twin Axes)
2942
- # when these attributes don't even exist yet, in which case
2943
- # `get_children` would raise an AttributeError.
2944
2941
if self ._xmargin and scalex and self .get_autoscalex_on ():
2945
2942
x_stickies = np .sort (np .concatenate ([
2946
2943
artist .sticky_edges .x
2947
2944
for ax in self ._shared_axes ["x" ].get_siblings (self )
2948
- if hasattr (ax ,"_children" )
2949
2945
for artist in ax .get_children ()]))
2950
2946
if self ._ymargin and scaley and self .get_autoscaley_on ():
2951
2947
y_stickies = np .sort (np .concatenate ([
2952
2948
artist .sticky_edges .y
2953
2949
for ax in self ._shared_axes ["y" ].get_siblings (self )
2954
- if hasattr (ax ,"_children" )
2955
2950
for artist in ax .get_children ()]))
2956
2951
if self .get_xscale ()== 'log' :
2957
2952
x_stickies = x_stickies [x_stickies > 0 ]