@@ -250,7 +250,7 @@ def __init__(self):
250
250
self .figure = self
251
251
# list of child gridspecs for this figure
252
252
self ._gridspecs = []
253
- self ._localaxes = [] # keep track of axes at this level
253
+ self ._localaxes = _AxesStack () # keep track of axes at this level
254
254
self .artists = []
255
255
self .lines = []
256
256
self .patches = []
@@ -276,7 +276,7 @@ def _get_draw_artists(self, renderer):
276
276
artists = sorted (
277
277
(artist for artist in artists if not artist .get_animated ()),
278
278
key = lambda artist : artist .get_zorder ())
279
- for ax in self ._localaxes :
279
+ for ax in self ._localaxes . as_list () :
280
280
locator = ax .get_axes_locator ()
281
281
if locator :
282
282
pos = locator (ax , renderer )
@@ -345,7 +345,7 @@ def get_children(self):
345
345
"""Get a list of artists contained in the figure."""
346
346
return [self .patch ,
347
347
* self .artists ,
348
- * self ._localaxes ,
348
+ * self ._localaxes . as_list () ,
349
349
* self .lines ,
350
350
* self .patches ,
351
351
* self .texts ,
@@ -836,7 +836,7 @@ def add_subplot(self, *args, **kwargs):
836
836
def _add_axes_internal (self , key , ax ):
837
837
"""Private helper for `add_axes` and `add_subplot`."""
838
838
self ._axstack .add (key , ax )
839
- self ._localaxes += [ ax ]
839
+ self ._localaxes . add ( key , ax )
840
840
self .sca (ax )
841
841
ax ._remove_method = self .delaxes
842
842
self .stale = True
@@ -2020,7 +2020,7 @@ def get_axes(self):
2020
2020
Return a list of axes in the SubPanel. You can access and modify the
2021
2021
axes in the Figure through this list.
2022
2022
"""
2023
- return self ._localaxes
2023
+ return self ._localaxes . as_list ()
2024
2024
2025
2025
axes = property (get_axes , doc = """
2026
2026
List of axes in the Figure. You can access and modify the axes
0 commit comments