'How to create multiple heatmaps

I have code as below that plots 6 scatterplots side by side.

import numpy as np
import pandas as pd
df_emb = pd.DataFrame(np.random.rand(1000,2))
df_emb['randNumCol'] = np.random.randint(0,6, size=len(df_emb))
df_emb.columns=['X','Y','label']
df_emb.head()

import matplotlib.pyplot as plt
import seaborn as sns



grid = sns.FacetGrid(df_emb, col = "label", hue = "label", col_wrap=3)
grid.map(sns.scatterplot, "X", "Y")

grid.add_legend()

plt.show()

enter image description here

1) Is there any way to plot heatmaps instead of scatterplots? I tried grid.map(sns.heatmap, "X", "Y") but that doesnt work. I want to show specific areas on each map where there is higher density of observations

2) if I have another list which has actual meaning of labels for example labels_meaning=['a','b','c','d','e','f'] then how could I display those labels instead of 0,1,2 etc



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source