code: def plot_pca_interactive(data, n_components=6):
      from sklearn.decomposition import PCA
      from IPython.html.widgets import interact
  
      pca = PCA(n_components=n_components)
      Xproj = pca.fit_transform(data)
  
      def show_decomp(i=0):
          plot_image_components(
              data[i], Xproj[i], pca.mean_, pca.components_
          )
  
      interact(show_decomp, i=(0, data.shape[0] - 1))
  
file_path: data-science-ipython-notebooks/scikit-learn/fig_code/figures.py
imports: import numpy
  import matplotlib.pyplot
  import warnings
label_desc: Use image node_id 7 for calling a global function with example usage: plot_pca_interactive(data, n_components) without return types