Bio Bio - 2 months ago 63
Python Question

Make the size of a heatmap bigger with seaborn

I create a heatmap with seaborn

df1.index = pd.to_datetime(df1.index)
df1 = df1.set_index('TIMESTAMP')
df1 = df1.resample('30min').mean()
ax = sns.heatmap(df1.iloc[:, 1:6:], annot=True, linewidths=.5)

But the probleme is when there is lot of data in the dataframe the heatmap will be too small and the value inside begin not clear like in the attached image.

How can I change the size of the heatmap to be more bigger ?
Thank youenter image description here


You could alter the figsize by passing a tuple showing the width, height parameters you would like to keep.

import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(10,10))         # Sample figsize in inches
sns.heatmap(df1.iloc[:, 1:6:], annot=True, linewidths=.5, ax=ax)