1import matplotlib.pyplot as plt
2import numpy as np
3
4# Simple data to display
5x = np.linspace(0, 2 * np.pi, 400)
6y = np.sin(x ** 2)
7
8# the container holding the two Axes have already been unpacked
9# useful if just few Axes have been created
10f, (ax1, ax2) = plt.subplots(1, 2)
11ax1.plot(x, y)
12ax1.set_title('Left plot')
13
14ax2.scatter(x, y)
15ax2.set_title('Right plot')
16
17plt.tight_layout()
18plt.show()