10000 Closes issue #1595 - sorting on a list of tuples can sometimes cause … · matplotlib/matplotlib@0ce0659 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ce0659

Browse files
committed
Closes issue #1595 - sorting on a list of tuples can sometimes cause crashes
1 parent 10d5d6e commit 0ce0659

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"""
1212

1313
import warnings
14+
from operator import itemgetter
15+
1416
import matplotlib.axes as maxes
1517
from matplotlib.axes import Axes, rcParams
1618
from matplotlib import cbook
@@ -244,16 +246,14 @@ def draw(self, renderer):
244246
# Calculate projection of collections and zorder them
245247
zlist = [(col.do_3d_projection(renderer), col) \
246248
for col in self.collections]
247-
zlist.sort()
248-
zlist.reverse()
249+
zlist.sort(key=itemgetter(0), reverse=True)
249250
for i, (z, col) in enumerate(zlist):
250251
col.zorder = i
251252

252253
# Calculate projection of patches and zorder them
253254
zlist = [(patch.do_3d_projection(renderer), patch) \
254255
for patch in self.patches]
255-
zlist.sort()
256-
zlist.reverse()
256+
zlist.sort(key=itemgetter(0), reverse=True)
257257
for i, (z, patch) in enumerate(zlist):
258258
patch.zorder = i
259259

0 commit comments

Comments
 (0)
0