Skip to main content

R's BiPlot visual for PCA in Python

Project description

PyBiPlot: Principal Component Analysis Visual

This aims to reproduce the R's biplot visual for PCA where the visual combines both the scores and loadings. You'll see arrows representing the original variables' contributions to each principal component, and you'll also see how the data points project onto the components.

PyPi link: PyPi link

Explanation of PCA and PyBiPlot usecase link: PCA link

Features:

  • Flexibility through Optional Parameters: Multiple optional parameters allow users to customize the plot's appearance.

  • Support for Overlaying Plots: Users can decide to overlay the samples and loadings plots or display them side by side.

  • Dynamic Labeling: The script supports dynamic labeling based on the actual values of the projected data, loadings, and explained variances.

  • Arrow Representations for Loadings: Loadings are represented as arrows, pointing in the direction and magnitude of the loading.

Use:

BiPlot(ProjectedData, Loadings, ExplainedVar, **kwargs).plot()
  • ProjectedData: (pd.DataFrame) - The projected data.
  • Loadings: (pd.DataFrame) - The loadings data.
  • ExplainedVar: (list) - Explained variance for the components.

Optional Parameters (kwargs):

  • Fig_size: Figure size (default is (16, 12))
  • Fig_size_sub: Figure size for subplots (default is (20, 12))
  • Overlaid: Flag to overlay plots or not (default is True)
  • Plot_style: Style of the plot (default is 'seaborn-v0_8-bright')
  • Sample_colors: Colors for samples (default is 'blue')
  • Sample_size: Size of the sample points (default is 15)
  • Sample_labels: Flag to show sample labels or not (default is True)
  • Sample_labels_color: Color for sample labels (default is 'black')
  • Sample_labels_size: Size of the sample labels (default is 10)
  • Sample_labels_shift: Shift for sample labels (default is .02)
  • Arrow_colors: Color of the arrows (default is 'red')
  • Arrow_head_size: Size of the arrow heads (default is 0.05)
  • Arrow_labels: Flag to show arrow labels or not (default is True)
  • Arrow_labels_size: Size of the arrow labels (default is 10)
  • Arrow_labels_color: Color of the arrow labels (default is 'black')
  • Arrow_labels_shift: Shift for arrow labels (default is 1.15)
  • X_label_size: Size of the X-axis label (default is 15)
  • Y_label_size: Size of the Y-axis label (default is 15)
  • Title_size: Size of the title (default is 20)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybiplot-0.0.7.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybiplot-0.0.7-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pybiplot-0.0.7.tar.gz.

File metadata

  • Download URL: pybiplot-0.0.7.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.2

File hashes

Hashes for pybiplot-0.0.7.tar.gz
Algorithm Hash digest
SHA256 62ef4b046c47bb79a2720edce87c4d9035f0e9ba26d236fe53ea6e1494d06813
MD5 655999bbcf9e2e2fe7bc892fd2e94ec0
BLAKE2b-256 08ca2aaecdf2cbdd624851eb17d552f5f8e3719fc1fc5f6089ac509a7e1e117f

See more details on using hashes here.

File details

Details for the file pybiplot-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: pybiplot-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.2

File hashes

Hashes for pybiplot-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7f2c69f897f3f2eec2e8e2da1c2ade19e7a35f2a1f2b71291352d0a9d0b13501
MD5 1f08184e318478afd155329f191d6e02
BLAKE2b-256 11a94959acb018737df8582d47d81cbf3aafdb45f5d667bb08b011fb379559e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page