.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/utils/plot_pca_components.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_glr_examples_utils_plot_pca_components.py: ====================================================== Plot principal components analysis (PCA) components ====================================================== visualizes the PCA coefficients as a heatmap .. GENERATED FROM PYTHON SOURCE LINES 8-11 .. code-block:: Python # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 12-13 Plot can be made with PCA objects .. GENERATED FROM PYTHON SOURCE LINES 13-21 .. code-block:: Python from watex.datasets import fetch_data from watex.utils.plotutils import plot_pca_components from watex.analysis import nPCA X, _= fetch_data('bagoue pca') pca = nPCA (X, n_components=2, return_X =False)# to return object plot_pca_components (pca) .. image-sg:: /glr_examples/utils/images/sphx_glr_plot_pca_components_001.png :alt: plot pca components :srcset: /glr_examples/utils/images/sphx_glr_plot_pca_components_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 22-23 Plot made using the components and features individually .. GENERATED FROM PYTHON SOURCE LINES 23-27 .. code-block:: Python components = pca.components_ features = pca.feature_names_in_ plot_pca_components (components, feature_names= features, cmap='jet_r') .. image-sg:: /glr_examples/utils/images/sphx_glr_plot_pca_components_002.png :alt: plot pca components :srcset: /glr_examples/utils/images/sphx_glr_plot_pca_components_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.458 seconds) .. _sphx_glr_download_glr_examples_utils_plot_pca_components.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/watex/watex/0.3.X?urlpath=lab/tree/notebooks/glr_examples/utils/plot_pca_components.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pca_components.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pca_components.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_