@@ -1191,6 +1191,8 @@ def _contour_level_args(self, z, args):
11911191 self .levels = lev
11921192 if self .filled and len (self .levels ) < 2 :
11931193 raise ValueError ("Filled contours require at least 2 levels." )
1194+ if len (self .levels ) > 1 and np .amin (np .diff (self .levels )) <= 0.0 :
1195+ raise ValueError ("Contour levels must be increasing" )
11941196
11951197 def _process_levels (self ):
11961198 """
@@ -1674,13 +1676,15 @@ def _initialize_x_y(self, z):
16741676 contour(Z,V)
16751677 contour(X,Y,Z,V)
16761678
1677- draw contour lines at the values specified in sequence *V*
1679+ draw contour lines at the values specified in sequence *V*,
1680+ which must be in increasing order.
16781681
16791682 ::
16801683
16811684 contourf(..., V)
16821685
1683- fill the ``len(V)-1`` regions between the values in *V*
1686+ fill the ``len(V)-1`` regions between the values in *V*,
1687+ which must be in increasing order.
16841688
16851689 ::
16861690
@@ -1743,8 +1747,8 @@ def _initialize_x_y(self, z):
17431747
17441748 *levels*: [level0, level1, ..., leveln]
17451749 A list of floating point numbers indicating the level
1746- curves to draw; e.g., to draw just the zero contour pass
1747- ``levels=[0]``
1750+ curves to draw, in increasing order ; e.g., to draw just
1751+ the zero contour pass ``levels=[0]``
17481752
17491753 *origin*: [ *None* | 'upper' | 'lower' | 'image' ]
17501754 If *None*, the first value of *Z* will correspond to the
0 commit comments