Reputation: 275
I have hundreds of features and I want to visualize their correlation in Python. But the code below does not display all feature captions in the chart. What solution do you suggest?
df = pd.read_csv('dataset.csv', sep=',')
sns.heatmap(df.corr())
plt.show()
Upvotes: 5
Views: 10120
Reputation: 5079
Without figsize & dpi, seems so collapsed.
import seaborn as sns
sns.heatmap(df.corr(), annot = True, fmt = '.2f')
For to make it more readable, adjust figsize & dpi according to your needings. That's max dpi and figsize I can use for this example df otherwise it exceeds 2MB
import seaborn as sns
fig = plt.figure(figsize=(36,36), dpi = 480)
sns.heatmap(df.corr(), annot = True, fmt = '.2f')
Upvotes: 3