@@ -1191,6 +1191,8 @@ def _contour_level_args(self, z, args):
1191
1191
self .levels = lev
1192
1192
if self .filled and len (self .levels ) < 2 :
1193
1193
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" )
1194
1196
1195
1197
def _process_levels (self ):
1196
1198
"""
@@ -1674,13 +1676,15 @@ def _initialize_x_y(self, z):
1674
1676
contour(Z,V)
1675
1677
contour(X,Y,Z,V)
1676
1678
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.
1678
1681
1679
1682
::
1680
1683
1681
1684
contourf(..., V)
1682
1685
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.
1684
1688
1685
1689
::
1686
1690
@@ -1743,8 +1747,8 @@ def _initialize_x_y(self, z):
1743
1747
1744
1748
*levels*: [level0, level1, ..., leveln]
1745
1749
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]``
1748
1752
1749
1753
*origin*: [ *None* | 'upper' | 'lower' | 'image' ]
1750
1754
If *None*, the first value of *Z* will correspond to the
0 commit comments