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

Skip to content

Commit ea656bb

Browse files
committed
Support setting zorder keyword for ContourSet.
svn path=/trunk/matplotlib/; revision=8098
1 parent 06bc628 commit ea656bb

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/matplotlib/contour.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,13 @@ def __init__(self, ax, *args, **kwargs):
695695

696696
paths = self._make_paths(segs, kinds)
697697

698+
# Default zorder taken from Collection
699+
zorder = kwargs.get('zorder', 1)
698700
col = collections.PathCollection(paths,
699701
antialiaseds = (self.antialiased,),
700702
edgecolors= 'none',
701-
alpha=self.alpha)
703+
alpha=self.alpha,
704+
zorder=zorder)
702705
self.ax.add_collection(col)
703706
self.collections.append(col)
704707
else:
@@ -710,10 +713,14 @@ def __init__(self, ax, *args, **kwargs):
710713
nseg = len(nlist)//2
711714
segs = nlist[:nseg]
712715
#kinds = nlist[nseg:]
716+
717+
# Default zorder taken from LineCollection
718+
zorder = kwargs.get('zorder', 2)
713719
col = collections.LineCollection(segs,
714720
linewidths = width,
715721
linestyle = lstyle,
716-
alpha=self.alpha)
722+
alpha=self.alpha,
723+
zorder=zorder)
717724

718725
col.set_label('_nolegend_')
719726
self.ax.add_collection(col, False)
@@ -1228,4 +1235,3 @@ def find_nearest_contour( self, x, y, indices=None, pixel=True ):
12281235
ymin = lc[imin,1]
12291236

12301237
return (conmin,segmin,imin,xmin,ymin,dmin)
1231-

0 commit comments

Comments
 (0)