Skip to content

Commit

Permalink
Fixed contours levels integer kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 22, 2018
1 parent 026d700 commit 0147b3e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions holoviews/operation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,18 @@ def _process(self, element, key=None):

levels = self.p.levels
zmin, zmax = element.range(2)
if zmin == zmax:
contours = contour_type([], [xdim, ydim], vdims)
return (element * contours) if self.p.overlaid else contours
if isinstance(self.p.levels, int):
if zmin == zmax:
contours = contour_type([], [xdim, ydim], vdims)
return (element * contours) if self.p.overlaid else contours
kwargs = {'N': self.p.levels}
else:
kwargs = {'levels': levels}

fig = Figure()
ax = Axes(fig, [0, 0, 1, 1])
contour_set = QuadContourSet(ax, *data, filled=self.p.filled,
extent=extent, levels=levels)
extent=extent, **kwargs)
levels = np.array(contour_set.get_array())
crange = levels.min(), levels.max()
if self.p.filled:
Expand Down

0 comments on commit 0147b3e

Please sign in to comment.