import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
fig, axes = plt.subplots(nrows=3, ncols=2)
# You can call fig.tight_layout() for more good looking figure.
# fig.tight_layout()
print(type(fig))
print(type(axes))
print(type(axes[0, 0]))
x = np.linspace(0, 10, 100)
y = x ** 2
fig, ax1 = plt.subplots(1,1)
ax1.plot(x, y)
x = np.linspace(0, 10, 100)
y = x ** 2
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1) # this is the same as fig.add_subplot(111)
ax1.plot(x, y)
x = np.linspace(0, 10, 100)
y = x ** 2
y2 = np.sqrt(x)
fig = plt.figure()
ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # [left, bottom, width, height]
ax1.plot(x, y)
ax2 = fig.add_axes([0.2, 0.5, 0.4, 0.3])
ax2.plot(x, y2)