Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd71598

Browse files
committed
Draw artists with identical zorder in the order in which they were added.
svn path=/trunk/matplotlib/; revision=8000
1 parent 2e04cab commit fd71598

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,10 +1700,10 @@ def draw(self, renderer=None, inframe=False):
17001700

17011701
dsu = [ (a.zorder, a) for a in artists
17021702
if not a.get_animated() ]
1703-
dsu.sort()
1703+
dsu.sort(key=lambda x: x[0])
17041704

17051705

1706-
# rasterze artists with negative zorder
1706+
# rasterize artists with negative zorder
17071707
# if the minimum zorder is negative, start rasterization
17081708
rasterization_zorder = self._rasterization_zorder
17091709
if len(dsu) > 0 and dsu[0][0] < rasterization_zorder:
@@ -1722,15 +1722,15 @@ def draw(self, renderer=None, inframe=False):
17221722
if len(self.images)<=1 or renderer.option_image_nocomposite():
17231723
for im in self.images:
17241724
dsu.append( (im.zorder, im) )
1725-
dsu.sort() # re-sort with images now
1725+
dsu.sort(key=lambda x: x[0]) # re-sort with images now
17261726
else:
17271727
# make a composite image blending alpha
17281728
# list of (mimage.Image, ox, oy)
17291729

17301730
zorder_images = [(im.zorder, im) for im in self.images \
17311731
if im.get_visible()]
1732-
zorder_images.sort()
1733-
1732+
zorder_images.sort(key=lambda x: x[0])
1733+
17341734
mag = renderer.get_image_magnification()
17351735
ims = [(im.make_image(mag),0,0) for z,im in zorder_images]
17361736

@@ -1793,7 +1793,7 @@ def __draw_animate(self):
17931793
if self._lastRenderer is None:
17941794
raise RuntimeError('You must first call ax.draw()')
17951795
dsu = [(a.zorder, a) for a in self.animated.keys()]
1796-
dsu.sort()
1796+
dsu.sort(key=lambda x: x[0])
17971797
renderer = self._lastRenderer
17981798
renderer.blit()
17991799
for tmp, a in dsu:

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def draw_composite():
798798
dsu.append( (a.get_zorder(), a.draw, [renderer]))
799799

800800

801-
dsu.sort()
801+
dsu.sort(key=lambda x: x[0])
802802
for zorder, func, args in dsu:
803803
func(*args)
804804

0 commit comments

Comments
 (0)