center = xy.mean(axis=-1)
for ax in [ax1, ax2]:
    ax.plot(x, y, 'ro')
ax.axis('equal')
for val, vec in zip(eigvals, eigvecs.T):
    val *= 2
x, y = np.vstack((center + val * vec, center, center - val * vec)).T
ax2.plot(x, y, 'b-', lw=3)
plt.show()
Estimating aspect ratio of a convex hull