mu = data.mean(axis=0)
data = data - mu
eigenvectors, eigenvalues, V = np.linalg.svd(data.T, full_matrices=False)
projected_data = np.dot(data, eigenvectors)
sigma = projected_data.std(axis=0).mean()
print(eigenvectors)
fig, ax = plt.subplots()
ax.scatter(xData, yData)
for axis in eigenvectors:
    start, end = mu, mu + sigma * axis
ax.annotate('', xy=end, xycoords='data', xytext=start, textcoords='data',
    arrowprops=dict(facecolor='red', width=2.0))
ax.set_aspect('equal')
plt.show()
Basic example for PCA with matplotlib