matplotlib plot dua grafik berdampingan

import matplotlib.pyplot as plt
import numpy as np

# Simple data to display 
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)

# the container holding the two Axes have already been unpacked
# useful if just few Axes have been created
f, (ax1, ax2) = plt.subplots(1, 2) 
ax1.plot(x, y)
ax1.set_title('Left plot')

ax2.scatter(x, y)
ax2.set_title('Right plot')

plt.tight_layout()
plt.show()
wolf-like_hunter