I have a 2D array with three different values [-1,0,1]. I have specified a custom bokeh color palette to give each value a different color.
I overlay this three valued image onto another image with 256 gray values.
For visual purposes I want make all values of -1 in three valued image transparent, i.e. I want to give the image glyph multiple alpha values.
Is there a way to achieve this in bokeh?
Here is some example code of plotting an image with a color palette: bokeh color image example
You can specify alpha in palettes:
from bokeh.io import show
from bokeh.plotting import figure
p = figure()
p.image(image=[[[-1, 0, 1],
[1, -1, 0],
[0, 1, -1]]],
x=[0], y=[0], dw=[1], dh=[1],
palette=['rgba(0, 0, 0, 0)', 'red', 'blue'])
show(p)