@@ -51,7 +51,7 @@ class ContourLabeler:
5151 def clabel (self , levels = None , * ,
5252 fontsize = None , inline = True , inline_spacing = 5 , fmt = '%1.3f' ,
5353 colors = None , use_clabeltext = False , manual = False ,
54- rightside_up = True ):
54+ rightside_up = True , zorder = None ):
5555 """
5656 Label a contour plot.
5757
@@ -124,6 +124,11 @@ def clabel(self, levels=None, *,
124124 of texts during the drawing time, therefore this can be used if
125125 aspect of the axes changes.
126126
127+ zorder : float or None, optional
128+ zorder of the contour labels.
129+
130+ If not specified, the default zorder of `.Text` class is used.
131+
127132 Returns
128133 -------
129134 labels
@@ -144,6 +149,7 @@ def clabel(self, levels=None, *,
144149 # Detect if manual selection is desired and remove from argument list.
145150 self .labelManual = manual
146151 self .rightside_up = rightside_up
152+ self ._zorder = zorder
147153
148154 if levels is None :
149155 levels = self .levels
@@ -397,7 +403,7 @@ def _get_label_text(self, x, y, rotation):
397403 dx , dy = self .ax .transData .inverted ().transform ((x , y ))
398404 t = text .Text (dx , dy , rotation = rotation ,
399405 horizontalalignment = 'center' ,
400- verticalalignment = 'center' )
406+ verticalalignment = 'center' , zorder = self . _zorder )
401407 return t
402408
403409 def _get_label_clabeltext (self , x , y , rotation ):
@@ -411,7 +417,7 @@ def _get_label_clabeltext(self, x, y, rotation):
411417 np .array ([[x , y ]]))
412418 t = ClabelText (dx , dy , rotation = drotation [0 ],
413419 horizontalalignment = 'center' ,
414- verticalalignment = 'center' )
420+ verticalalignment = 'center' , zorder = self . _zorder )
415421
416422 return t
417423
0 commit comments