The following python script will perform a PCA transformation on 2D data points using sklearn (Python machine learning modules).
Tested in python 2.7.6, numpy 1.9.0, scipy-0.14.0, matplotlib.pyplot-1.3.1, sklearn 0.15.2
Prepared by Dr. Pin-Chih Su
More details: https://sites.google.com/site/2015pcsu/codes/pca