@@ -2005,20 +2005,16 @@ def draw(self, renderer=None, inframe=False):
20052005 else :
20062006 self .apply_aspect ()
20072007
2008- artists = []
2009-
2010- artists .extend (self .collections )
2011- artists .extend (self .patches )
2012- artists .extend (self .lines )
2013- artists .extend (self .texts )
2014- artists .extend (self .artists )
2008+ artists = self .get_children ()
2009+ artists .remove (self .patch )
20152010
20162011 # the frame draws the edges around the axes patch -- we
20172012 # decouple these so the patch can be in the background and the
20182013 # frame in the foreground. Do this before drawing the axis
20192014 # objects so that the spine has the opportunity to update them.
2020- if self .axison and self ._frameon :
2021- artists .extend (six .itervalues (self .spines ))
2015+ if not (self .axison and self ._frameon ):
2016+ for spine in six .itervalues (self .spines ):
2017+ artists .remove (spine )
20222018
20232019 if self .axison and not inframe :
20242020 if self ._axisbelow :
@@ -2027,28 +2023,29 @@ def draw(self, renderer=None, inframe=False):
20272023 else :
20282024 self .xaxis .set_zorder (2.5 )
20292025 self .yaxis .set_zorder (2.5 )
2030- artists .extend ([self .xaxis , self .yaxis ])
2031- if not inframe :
2032- artists .append (self .title )
2033- artists .append (self ._left_title )
2034- artists .append (self ._right_title )
2035- artists .extend (self .tables )
2036- if self .legend_ is not None :
2037- artists .append (self .legend_ )
2038-
2039- if self .figure .canvas .is_saving ():
2040- dsu = [(a .zorder , a ) for a in artists ]
20412026 else :
2042- dsu = [(a .zorder , a ) for a in artists
2043- if not a .get_animated ()]
2027+ artists .remove (self .xaxis )
2028+ artists .remove (self .yaxis )
2029+
2030+ if inframe :
2031+ artists .remove (self .title )
2032+ artists .remove (self ._left_title )
2033+ artists .remove (self ._right_title )
20442034
20452035 # add images to dsu if the backend supports compositing.
20462036 # otherwise, does the manual compositing without adding images to dsu.
20472037 if len (self .images ) <= 1 or renderer .option_image_nocomposite ():
2048- dsu .extend ([(im .zorder , im ) for im in self .images ])
20492038 _do_composite = False
20502039 else :
20512040 _do_composite = True
2041+ for im in self .images :
2042+ artists .remove (im )
2043+
2044+ if self .figure .canvas .is_saving ():
2045+ dsu = [(a .zorder , a ) for a in artists ]
2046+ else :
2047+ dsu = [(a .zorder , a ) for a in artists
2048+ if (not a .get_animated () or a in self .images )]
20522049
20532050 dsu .sort (key = itemgetter (0 ))
20542051
@@ -3193,22 +3190,22 @@ def set_cursor_props(self, *args):
31933190 def get_children (self ):
31943191 """return a list of child artists"""
31953192 children = []
3196- children .append (self .xaxis )
3197- children .append (self .yaxis )
3198- children .extend (self .lines )
3193+ children .extend (self .collections )
31993194 children .extend (self .patches )
3195+ children .extend (self .lines )
32003196 children .extend (self .texts )
3201- children .extend (self .tables )
32023197 children .extend (self .artists )
3203- children .extend (self .images )
3204- if self .legend_ is not None :
3205- children .append (self .legend_ )
3206- children .extend (self .collections )
3198+ children .extend (six .itervalues (self .spines ))
3199+ children .append (self .xaxis )
3200+ children .append (self .yaxis )
32073201 children .append (self .title )
32083202 children .append (self ._left_title )
32093203 children .append (self ._right_title )
3204+ children .extend (self .tables )
3205+ children .extend (self .images )
3206+ if self .legend_ is not None :
3207+ children .append (self .legend_ )
32103208 children .append (self .patch )
3211- children .extend (six .itervalues (self .spines ))
32123209 return children
32133210
32143211 def contains (self , mouseevent ):
0 commit comments