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

Skip to content

Commit f8b9997

Browse files
committed
Fixed bug in implementation of contour 'extend' kw
svn path=/trunk/matplotlib/; revision=2945
1 parent 451a015 commit f8b9997

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def _mesh(self):
428428

429429
def _locate(self, x):
430430
'''
431-
Given a possible set of color date values, return the ones
431+
Given a possible set of color data values, return the ones
432432
within range, together with their corresponding colorbar
433433
data coordinates.
434434
'''

lib/matplotlib/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,9 @@ def _contour_args(self, *args):
628628
# + "with use of 'extend' kwarg")
629629
self._levels = list(self.levels)
630630
if self.extend in ('both', 'min'):
631-
self._levels.insert(0, self.zmin - 1)
631+
self._levels.insert(0, min(self.levels[0],self.zmin) - 1)
632632
if self.extend in ('both', 'max'):
633-
self._levels.append(self.zmax + 1)
633+
self._levels.append(max(self.levels[-1],self.zmax) + 1)
634634
self._levels = asarray(self._levels)
635635
self.vmin = amin(self.levels) # alternative would be self.layers
636636
self.vmax = amax(self.levels)

0 commit comments

Comments
 (0)