I built a heatmap in Bokeh which works fine. I want it to be colored from bright green to bright red, continuously. The current code is:
colors = ["#66ff00", "#FFFFFF", "#FF0000"]
colors.reverse()
mapper = LinearColorMapper(palette=colors, low=-50, high=50)
p.rect(..., fill_color=transform('percentage', mapper))
The problem is that only 3 colors are appearing in the heatmap. I would expect all values between -50 and 50 to linearly interpolate the values between bright red to white to bright green and show up in the heatmap. How can I achieve this?
As of version 2.3.1, palettes are just lists of colors, and currently existing colormappers just use palettes, as given, without modifying them. If you want more colors you would need to interpolate the palette (list of colors) out to whatever size you want before passing it to Bokeh. The "Linear" in LinearColorMapper
refers to how values are linearly mapped into the bins defined by a palette.