How to plot PCA `loadings` and `loading.label` like R's `autoplot` w/ `matplotlib` and `sklearn`?
<p>I saw this tutorial in <code>R</code> w/ <code>autoplot</code>.  They plotted the loadings and loading labels:</p>

<pre><code>autoplot(prcomp(df), data = iris, colour = 'Species',
         loadings = TRUE, loadings.colour = 'blue',
         loadings.label = TRUE, loadings.label.size = 3)
</code></pre>

<p><a href="http://i.stack.imgur.com/QRuAn.png" rel="nofollow"><img src="http://i.stack.imgur.com/QRuAn.png" alt="enter image description here"></a>
<a href="https://cran.r-project.org/web/packages/ggfortify/vignettes/plot_pca.html" rel="nofollow">https://cran.r-project.org/web/packages/ggfortify/vignettes/plot_pca.html</a></p>

<p>I prefer <code>Python 3</code> w/ <code>matplotlib, scikit-learn, and pandas</code> for my data analysis.  However, I don't know how to add these on?  </p>

<p><strong>How can you plot these vectors w/ <code>matplotlib</code>?</strong> </p>

<p>I've been reading <a href="http://stackoverflow.com/questions/22984335/recovering-features-names-of-explained-variance-ration-in-pca-with-sklearn">Recovering features names of explained_variance_ration in PCA with sklearn</a> but haven't figured it out yet</p>

<p>Here's how I plot it in <code>Python</code></p>

<pre><code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.preprocessing import StandardScaler
from sklearn import decomposition
import seaborn as sns; sns.set_style("whitegrid", {'axes.grid' : False})

%matplotlib inline
np.random.seed(0)

# Iris dataset
DF_data = pd.DataFrame(load_iris().data, 
                       index = ["iris_%d" % i for i in range(load_iris().data.shape[0])],
                       columns = load_iris().feature_names)

Se_targets = pd.Series(load_iris().target, 
                       index = ["iris_%d" % i for i in range(load_iris().data.shape[0])], 
                       name = "Species")

# Scaling mean = 0, var = 1
DF_standard = pd.DataFrame(StandardScaler().fit_transform(DF_data), 
                           index = DF_data.index,
                           columns = DF_data.columns)

# Sklearn for Principal Componenet Analysis
# Dims
m = DF_standard.shape[1]
K = 2

# PCA (How I tend to set it up)
Mod_PCA = decomposition.PCA(n_components=m)
DF_PCA = pd.DataFrame(Mod_PCA.fit_transform(DF_standard), 
                      columns=["PC%d" % k for k in range(1,m + 1)]).iloc[:,:K]
# Color classes
color_list = [{0:"r",1:"g",2:"b"}[x] for x in Se_targets]

fig, ax = plt.subplots()
ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"], color=color_list)
</code></pre>

<p><a href="http://i.stack.imgur.com/9dO1P.png" rel="nofollow"><img src="http://i.stack.imgur.com/9dO1P.png" alt="enter image description here"></a></p>

<p>I found the answer here by @teddyroland: <a href="https://github.com/teddyroland/python-biplot/blob/master/biplot.py" rel="nofollow">https://github.com/teddyroland/python-biplot/blob/master/biplot.py</a></p>

python matplotlib plot ggplot2 pca