@@ -203,7 +203,7 @@ def __init__(self, **kwargs):
203
203
self .figure = self
204
204
# list of child gridspecs for this figure
205
205
self ._gridspecs = []
206
- self ._localaxes = _AxesStack () # track all axes and current axes
206
+ self ._localaxes = [] # track all axes
207
207
self .artists = []
208
208
self .lines = []
209
209
self .patches = []
@@ -229,7 +229,7 @@ def _get_draw_artists(self, renderer):
229
229
artists = sorted (
230
230
(artist for artist in artists if not artist .get_animated ()),
231
231
key = lambda artist : artist .get_zorder ())
232
- for ax in self ._localaxes . as_list () :
232
+ for ax in self ._localaxes :
233
233
locator = ax .get_axes_locator ()
234
234
if locator :
235
235
pos = locator (ax , renderer )
@@ -294,7 +294,7 @@ def get_children(self):
294
294
"""Get a list of artists contained in the figure."""
295
295
return [self .patch ,
296
296
* self .artists ,
297
- * self ._localaxes . as_list () ,
297
+ * self ._localaxes ,
298
298
* self .lines ,
299
299
* self .patches ,
300
300
* self .texts ,
@@ -776,7 +776,8 @@ def add_subplot(self, *args, **kwargs):
776
776
def _add_axes_internal (self , ax , key ):
777
777
"""Private helper for `add_axes` and `add_subplot`."""
778
778
self ._axstack .add (ax )
779
- self ._localaxes .add (ax )
779
+ if ax not in self ._localaxes :
780
+ self ._localaxes .append (ax )
780
781
self .sca (ax )
781
782
ax ._remove_method = self .delaxes
782
783
# this is to support plt.subplot's re-selection logic
@@ -2081,14 +2082,14 @@ def axes(self):
2081
2082
List of Axes in the SubFigure. You can access and modify the Axes
2082
2083
in the SubFigure through this list.
2083
2084
2084
- Do not modify the list itself . Instead, use `~.SubFigure.add_axes`,
2085
+ Modifying this list has no effect . Instead, use `~.SubFigure.add_axes`,
2085
2086
`~.SubFigure.add_subplot` or `~.SubFigure.delaxes` to add or remove an
2086
2087
Axes.
2087
2088
2088
2089
Note: The `.SubFigure.axes` property and `~.SubFigure.get_axes` method
2089
2090
are equivalent.
2090
2091
"""
2091
- return self ._localaxes . as_list ()
2092
+ return self ._localaxes [:]
2092
2093
2093
2094
get_axes = axes .fget
2094
2095
0 commit comments