# setup the coloring levels = MaxNLocator(nbins=10 * MAX_VAL + 1).tick_values(0, MAX_VAL) cmap = get_cmap('viridis') cmap.set_bad(color='k') cmap.set_under(color='k') cmap.set_over(color='w') norm = Normalize(vmin=0, vmax=MAX_VAL, clip=False) sm = ScalarMappable(norm=norm, cmap=cmap) color_pal = [ RGB(*val).to_hex() for val in sm.to_rgba(levels, bytes=True, norm=True)[:-1] ] color_mapper = LinearColorMapper(color_pal, low=sm.get_clim()[0], high=sm.get_clim()[1]) l = levels.copy()[::3] l[0] = GREY_THRESHOLD ticker = FixedTicker(ticks=l) cb = ColorBar(color_mapper=color_mapper, location=(0, 0), scale_alpha=ALPHA, ticker=ticker) # make the bokeh figures without the data yet width = 1024 height = int(0.73 * width) sfmt = '%Y-%m-%d %HZ' tools = 'pan, box_zoom, reset, save' map_fig = figure(plot_width=width, plot_height=height, y_axis_type=None,