diff --git a/holoviews/plotting/bokeh/__init__.py b/holoviews/plotting/bokeh/__init__.py index e4a76514f7..fcaf55b6f1 100644 --- a/holoviews/plotting/bokeh/__init__.py +++ b/holoviews/plotting/bokeh/__init__.py @@ -1,5 +1,7 @@ from __future__ import absolute_import, division, unicode_literals +import sys + import numpy as np from bokeh.palettes import all_palettes @@ -150,7 +152,9 @@ # Register bokeh.palettes with Palette and Cycle def colormap_generator(palette): - return lambda value: palette[int(value*(len(palette)-1))] + # Epsilon ensures float precision doesn't cause issues (#4911) + epsilon = sys.float_info.epsilon*10 + return lambda value: palette[int(value*(len(palette)-1)+epsilon)] Palette.colormaps.update({name: colormap_generator(p[max(p.keys())]) for name, p in all_palettes.items()})