Search code examples
pythonmatplotlibgraphgraphicssubplot

how to choose the size of the graphics with subplot?


I plotted some graphs with subplot by the code bellow :

fig, axs = plt.subplots(1, 2)

for i in range (len(Yallp)):

    axs[0].plot(Dt,Yall[i])

    axs[1].plot(Dt,Yallp[i])

for ax in axs.flat:

    ax.set(xlabel='time scales', ylabel='$<C_{ij}>_{ij}$')

for ax in axs.flat:

    ax.label_outer()

axs[0].grid()

axs[1].grid()

'Yall' and 'Yallp' are two arrays of the same shape. I want to plot these arrays but I don't know how I can choose the size of the graphics. With subplot, python draws me graphs with a standard size and I want to enlarge them.


Solution

  • You can change the size of your plots with figsize parameter:

    fig, axs = plt.subplots(1, 2, figsize=(8,6))