How to plot combine two heatmaps on top of each other in python

I have two heatmaps I’ve made in python. I use seaborn for both of them, but I’m not wedded to it.

Both these heatmaps are on the same 20×20 grid. One of the heatmaps is a background, dividing the 20×20 grid into 3 large regions. The other heatmap shows a hotspot, a smaller box that is lit up, and then the rest of the background is zero.

I would like to superimpose the heatmap with the hotspot in front of the background heatmap. I haven’t found anything remotely helpful. Does anyone know of a good way to do this? I haven’t found how to do this in seaborn.

Here is my sample code, where background is one of the arrays and hotspot is the other array.

sns.heatmap(hotspot, cmap='RdBu_r')

But this just shows the heatmap for hotspot. I would like the heatmap for hotspot superimposed on the background.

Read more here: Source link