Ganesh Gebhard
Ganesh Gebhard

Reputation: 549

Make Python seaborn heatmap bigger

I use a heat map in Python to show the correlation between all parameters I have. The number of parameters however are that large that the heat map becomes to small to show the data.

Heat Map

The heat map is created using seaborn:

seaborn.heatmap(df.corr())

I tried to make it bigger using:

plt.subplots(figsize=(10,10))
seaborn.heatmap(df.corr())

but this didn't work since the image just remained its current size.

Does someone know another way of doing this? Or maybe another way to clearly plot the correlations between all parameters?

Regards, Ganesh

Upvotes: 0

Views: 6805

Answers (1)

DavidG
DavidG

Reputation: 25362

You should create the figure first (similar to how you tried) using:

fig, ax = plt.subplots(figsize=(10,10))

Then, pass in ax as an argument to seaborn.heatmap

import matplotlib.pyplot as plt
import seaborn

fig, ax = plt.subplots(figsize=(10,10))
seaborn.heatmap(df.corr(), ax=ax)
plt.show()

Upvotes: 4

Related Questions