How to change size of Seaborn Heatmap

You can change the size of the Seaborn heatmap with the following code. The given example helps you to understand how to change the size of the Seaborn heatmap. I highly recommend you “Python Crash Course Book” to learn Python.

Example: Change size of Heatmap

# Import the required libraries
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

# Create NumPy Array
data = np.random.randint(10, size=(10,10))

# select size
plt.figure(figsize=(12,5))

# Create Heatmap
sns.heatmap(data)

# Display the plot
plt.show()

Output:

Leave a Comment

Your email address will not be published.