How can I subtract two different kdeplots, so that the difference is displayed? Like in the picture on the top right, there is a green bubble which is overlapping the red one. Is it possible to subtract both datasets from each other and then display the difference? Like when the green dataset is larger than the red one on this specific spot, then the location is green.
My code looks like this:
import matplotlib.pyplot as plt
from PIL import Image
import seaborn as sns
from functions.getMinimapExtent import getMinimapExtent
from functions.getMinimapPath import getMinimapPath
def getHeatmap(x, y, map:str, title:str, x1, y1):
#x ~= [2054, 4225, 4234, 2134, 3552, 5632, ...]
#y ~= [1452, 2354, 6423, 3256, 2341, 5532, ...]
#x1 ~= [5323, 2535, 1535, 6433, 2356, 2353, ...]
#y1 ~= [6435, 2212, 3555, 2366, 7312, 1643, ...]
img = Image.open(getMinimapPath(map))
minimapExtent = getMinimapExtent(map)
plt.imshow(img, extent=minimapExtent)
# set seaborn style
sns.set_style("white")
# Custom the color, add shade and bandwidth
sns.kdeplot(x=x, y=y, cmap="Reds", shade=True, bw_adjust=.2, alpha=.6, thresh=0.25, zorder=-1)
sns.kdeplot(x=x1, y=y1, cmap="Greens", shade=True, bw_adjust=.2, alpha=.6, thresh=0.25, zorder=-1)
plt.title(title)
plt.axis("off")
plt.savefig("bot/data/img/heatmap.png", dpi=500, bbox_inches="tight")
plt.close()