Skip to content Skip to sidebar Skip to footer

Resize Subplots Using Seaborn

I have just recently started to use matplotlib and seaborn to plot my graphs. This is the code that I wrote so far count = 1 l=[13,0,47,29,10] plt.figure(figsize=(30,40)) for ww i

Solution 1:

The answer to the linked question directly tells you how to achieve a grid with unequal column width using GridSpec. I do not see much of a difference here, but maybe the following is more understandable for you, because it uses seaborn heatmaps, more than one row and no "ax".

import numpy as np
import matplotlib.pyplot as plt 
from matplotlib import gridspec
import seaborn as sns

# generate some data
x = np.arange(0, 10, 0.2)
y = np.sin(x)
X = np.random.rand(3,4)

fig = plt.figure(figsize=(8, 6)) 
gs = gridspec.GridSpec(5, 2, width_ratios=[2, 1]) 

for i in range(5):
    plt.subplot(gs[i*2+0])
    sns.heatmap(X)
    plt.subplot(gs[i*2+1])
    plt.plot(x,y)

plt.show()

Post a Comment for "Resize Subplots Using Seaborn"