@@ -203,7 +203,7 @@ def __init__(self, **kwargs):
203203 self .figure = self
204204 # list of child gridspecs for this figure
205205 self ._gridspecs = []
206- self ._localaxes = _AxesStack () # track all axes and current axes
206+ self ._localaxes = [] # track all axes
207207 self .artists = []
208208 self .lines = []
209209 self .patches = []
@@ -229,7 +229,7 @@ def _get_draw_artists(self, renderer):
229229 artists = sorted (
230230 (artist for artist in artists if not artist .get_animated ()),
231231 key = lambda artist : artist .get_zorder ())
232- for ax in self ._localaxes . as_list () :
232+ for ax in self ._localaxes :
233233 locator = ax .get_axes_locator ()
234234 if locator :
235235 pos = locator (ax , renderer )
@@ -294,7 +294,7 @@ def get_children(self):
294294 """Get a list of artists contained in the figure."""
295295 return [self .patch ,
296296 * self .artists ,
297- * self ._localaxes . as_list () ,
297+ * self ._localaxes ,
298298 * self .lines ,
299299 * self .patches ,
300300 * self .texts ,
@@ -776,7 +776,8 @@ def add_subplot(self, *args, **kwargs):
776776 def _add_axes_internal (self , ax , key ):
777777 """Private helper for `add_axes` and `add_subplot`."""
778778 self ._axstack .add (ax )
779- self ._localaxes .add (ax )
779+ if ax not in self ._localaxes :
780+ self ._localaxes .append (ax )
780781 self .sca (ax )
781782 ax ._remove_method = self .delaxes
782783 # this is to support plt.subplot's re-selection logic
@@ -2081,14 +2082,14 @@ def axes(self):
20812082 List of Axes in the SubFigure. You can access and modify the Axes
20822083 in the SubFigure through this list.
20832084
2084- Do not modify the list itself . Instead, use `~.SubFigure.add_axes`,
2085+ Modifying this list has no effect . Instead, use `~.SubFigure.add_axes`,
20852086 `~.SubFigure.add_subplot` or `~.SubFigure.delaxes` to add or remove an
20862087 Axes.
20872088
20882089 Note: The `.SubFigure.axes` property and `~.SubFigure.get_axes` method
20892090 are equivalent.
20902091 """
2091- return self ._localaxes . as_list ()
2092+ return self ._localaxes [:]
20922093
20932094 get_axes = axes .fget
20942095
0 commit comments