x = [1, 2, 3, 4]
y1 = [1, 4, 9, 16]
y2 = [1, 2, 3, 4]

plt.subplot(2, 1, 1)
plt.plot(x, y1, 'r--')
plt.title('First Plot')

plt.subplot(2, 1, 2)
plt.plot(x, y2, 'g*-')
plt.title('Second Plot')

plt.tight_layout()
plt.show()