diff --git a/holoviews/plotting/util.py b/holoviews/plotting/util.py index 6dcd6bb2fd..4cb3fc26da 100644 --- a/holoviews/plotting/util.py +++ b/holoviews/plotting/util.py @@ -989,8 +989,7 @@ def color_intervals(colors, levels, clip=None, N=255): if clip is not None: clmin, clmax = clip lidx = int(round(N*((clmin-cmin)/interval))) - uidx = int(round(N*((cmax-clmax)/interval))) - uidx = N-uidx + uidx = len(cmap) - int(round(N*((cmax-clmax)/interval))) if lidx == uidx: uidx = lidx+1 cmap = cmap[lidx:uidx] diff --git a/holoviews/tests/plotting/bokeh/test_pathplot.py b/holoviews/tests/plotting/bokeh/test_pathplot.py index a3adc691a9..8185cdcee0 100644 --- a/holoviews/tests/plotting/bokeh/test_pathplot.py +++ b/holoviews/tests/plotting/bokeh/test_pathplot.py @@ -131,7 +131,7 @@ def test_path_continuously_varying_color_op(self): self.assertEqual(source.data['date'], np.array([date]*3)) self.assertEqual(cmapper.low, 994) self.assertEqual(cmapper.high, 999) - self.assertEqual(cmapper.palette, colors[-1:]) + self.assertEqual(np.unique(cmapper.palette), colors[-1:]) def test_path_continuously_varying_alpha_op(self): xs = [1, 2, 3, 4] diff --git a/holoviews/tests/plotting/test_plotutils.py b/holoviews/tests/plotting/test_plotutils.py index 1f402691ad..1651607db8 100644 --- a/holoviews/tests/plotting/test_plotutils.py +++ b/holoviews/tests/plotting/test_plotutils.py @@ -598,7 +598,7 @@ def test_color_intervals_clipped(self): colors = ['#5ebaff', '#00faf4', '#ffffcc', '#ffe775', '#ffc140', '#ff8f20', '#ff6060'] cmap, lims = color_intervals(colors, levels, clip=(10, 90), N=100) self.assertEqual(cmap, ['#5ebaff', '#5ebaff', '#5ebaff', '#00faf4', '#00faf4', - '#00faf4', '#00faf4', '#ffffcc']) + '#00faf4', '#00faf4', '#ffffcc', '#ffffcc']) self.assertEqual(lims, (10, 90))