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

Skip to content

Commit f8eacb6

Browse files
committed
Added lines to _contour_args() to look for vmin/vmax input arguments and then min or max out the input z values accordingly.
1 parent 5e8d808 commit f8eacb6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/matplotlib/contour.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,17 @@ def _contour_args(self, args, kwargs):
14931493
else:
14941494
raise TypeError("Too many arguments to %s; see help(%s)" %
14951495
(fn, fn))
1496+
1497+
# Check for vmin and vmax values and max out z values accordingly
1498+
if 'vmax' in kwargs:
1499+
vmax = kwargs.pop('vmax')
1500+
ind = z > vmax
1501+
z[ind] = vmax
1502+
if 'vmin' in kwargs:
1503+
vmin = kwargs.pop('vmin')
1504+
ind = z < vmin
1505+
z[ind] = vmin
1506+
14961507
z = ma.masked_invalid(z, copy=False)
14971508
self.zmax = ma.maximum(z)
14981509
self.zmin = ma.minimum(z)

0 commit comments

Comments
 (0)