@@ -2005,20 +2005,16 @@ def draw(self, renderer=None, inframe=False):
2005
2005
else :
2006
2006
self .apply_aspect ()
2007
2007
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 )
2015
2010
2016
2011
# the frame draws the edges around the axes patch -- we
2017
2012
# decouple these so the patch can be in the background and the
2018
2013
# frame in the foreground. Do this before drawing the axis
2019
2014
# 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 )
2022
2018
2023
2019
if self .axison and not inframe :
2024
2020
if self ._axisbelow :
@@ -2027,28 +2023,29 @@ def draw(self, renderer=None, inframe=False):
2027
2023
else :
2028
2024
self .xaxis .set_zorder (2.5 )
2029
2025
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 ]
2041
2026
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 )
2044
2034
2045
2035
# add images to dsu if the backend supports compositing.
2046
2036
# otherwise, does the manual compositing without adding images to dsu.
2047
2037
if len (self .images ) <= 1 or renderer .option_image_nocomposite ():
2048
- dsu .extend ([(im .zorder , im ) for im in self .images ])
2049
2038
_do_composite = False
2050
2039
else :
2051
2040
_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 )]
2052
2049
2053
2050
dsu .sort (key = itemgetter (0 ))
2054
2051
@@ -3193,22 +3190,22 @@ def set_cursor_props(self, *args):
3193
3190
def get_children (self ):
3194
3191
"""return a list of child artists"""
3195
3192
children = []
3196
- children .append (self .xaxis )
3197
- children .append (self .yaxis )
3198
- children .extend (self .lines )
3193
+ children .extend (self .collections )
3199
3194
children .extend (self .patches )
3195
+ children .extend (self .lines )
3200
3196
children .extend (self .texts )
3201
- children .extend (self .tables )
3202
3197
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 )
3207
3201
children .append (self .title )
3208
3202
children .append (self ._left_title )
3209
3203
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_ )
3210
3208
children .append (self .patch )
3211
- children .extend (six .itervalues (self .spines ))
3212
3209
return children
3213
3210
3214
3211
def contains (self , mouseevent ):
0 commit comments