Holoviews Heatmap specify color for each point

I’m trying to generate a Heatmap in Holoviews with custom color values for each point, in order to specify different alpha color values.

Currently I’m generating two Holoviews plots with different alpha values and overlay them like so:

data = pd.DataFrame([(i, 97+j,  i*j) for i in range(5) for j in range(5)], 
                columns=['x', 'y', 'val'])
data_filtered = data[(data.x < 3) & (data.y < 100)]

hm_opts = dict(kdims=['x', 'y'], vdims=['val'])
hm = hv.HeatMap(data, **hm_opts).opts(alpha=0.5)
hm_filtered = hv.HeatMap(data_filtered, **hm_opts).opts()
hm * hm_filtered

Plot

This however, gives me a Holoviews Overlay object, where I’d like to have a single HeatMap object instead.

My idea was to map each x/y coordinate to a specific color value in hex form, which has the needed alpha already calculated into it. My DataFrame would therefore look something like this (example):

    x    y  val    color
0   0   97    0  #00FF00
1   0   98    0  #00FF00
2   0   99    0  #00FF00
...
22  4   99    8  #FFD29F
23  4  100   12  #FFB89F
24  4  101   16  #D3AFF4

Is there a way to tell Holoviews to use these colors?
When I pass the list of colors to the “cmap” parameter it interpretes it as color intervals, passing the name of the column raises an error as it cannot find the specified cmap.

When I pass the list to the “color” parameter, the plot is not displayed at all anymore in the Jupyter Notebook.

I also posted this question at StackOverflow.

Thanks for this post, @iRave! I came to ask a nearly identical question and the answer on StackOverflow enabled me to figure out how to customize my plot (I was trying to specify transparency and color for a boolean array).

On stackover flow. I answer in https://stackoverflow.com/a/64469912/4989371

Hope this help

Thanks, this certainly helped. I updated my code on StackOverflow with the help of your answer.