Matplotlib plt.subplots and plt.figure Change Figure Size

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
X = np.linspace(0,10,100)
y = np.sin(X)

Default figure size

plt.rcParams['figure.figsize']
[6.0, 4.0]
fig, ax = plt.subplots()
ax.plot(X, y)
plt.show()

Change figure size in plt.subplots

fig, ax = plt.subplots(figsize = (12,2))
ax.plot(X,y)
plt.show()

Change figure size in plt.figure

plt.figure(figsize = (10,3))
plt.plot(X,y)
plt.show()