0

Not getting proper size of seaborn heatmap of a correlation matrix. The plot is seemed to be cropped from top and bottom. Here's the code.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

np.random.seed(42)
data = np.random.randint(1, 1000, 100 * 3).reshape(-1, 3)
df = pd.DataFrame(data=data, columns=['x', 'y', 'z'])
corrMatrix = df.corr()

fig, ax = plt.subplots(figsize=(5, 5))
sns.heatmap(corrMatrix, annot=True, linewidths=.5, cmap="YlGnBu", square=True)
plt.show()

enter image description here

hovedguy
  • 71
  • 8

0 Answers0