.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/view/plot_biplot.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_view_plot_biplot.py: ======================================================= Plot bipolar with Principal component analysis (PCA) ======================================================= visualizes all-in-one features from PCA analysis. .. GENERATED FROM PYTHON SOURCE LINES 8-11 .. code-block:: Python # Author: L.Kouadio # Licence: BS3-clause .. GENERATED FROM PYTHON SOURCE LINES 12-14 :func:`~watex.view.biPlot` has an an implementation in R but there is no standard implementation in Python. Here is an example: .. GENERATED FROM PYTHON SOURCE LINES 14-29 .. code-block:: Python import matplotlib.pyplot as plt from watex.analysis import nPCA from watex.datasets import fetch_data from watex.view import biPlot, pobj # pobj is Baseplot instance X, y = fetch_data ('bagoue pca' ) # fetch pca data pca= nPCA (X, n_components= 2 , return_X= False ) # return PCA object components = pca.components_ [:2, :] # for two components # customize plot pobj.xlabel ="Axis 1: PC1" pobj.ylabel="Axis 2: PC2" pobj.font_size =20. biPlot (pobj, pca.X, components , y ) # pca.X is the reduced dim X # to change for instance the line width (lw) or line style (ls), # just use the baseplot-object *pobj* like:: # >>> pobj.ls ='-.'; pobj.lw=3 plt.show() .. image-sg:: /glr_examples/view/images/sphx_glr_plot_biplot_001.png :alt: plot biplot :srcset: /glr_examples/view/images/sphx_glr_plot_biplot_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.423 seconds) .. _sphx_glr_download_glr_examples_view_plot_biplot.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/view/plot_biplot.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_biplot.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_biplot.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_