add_subplot ( 111, aspect = 'equal' ) axes. components_, color = 'blue', width = 0.01, scale = 3 ) # projection components_, color = 'red', width = 0.01, scale = 3 ) axes. reshape ( 2, 1 )) print v * W # displayįig = plt. eig ( cv ) print 'eigenvector' print v print 'eigenvalue' print W # covariance matrix x eigenvector cov ( z, z, bias = 1 ) print 'mean' print mn print 'covariance' print cv W, v = np. mean ( X, axis = 0 ) z = X - mn cv = np. hlines ( 0, - 0.2, 1.4, linestyles = 'dashed' ) # PCAįrom composition import PCA pca = PCA ( n_components = 2 ) pca. Import numpy as np import matplotlib.pyplot as plt # generate data