explained_variance_ratio_plot#
- ktch.plot.explained_variance_ratio_plot(pca: Any, n_components: int | None = None, ax: object | None = None, verbose: bool = False) object[source]#
Plot explained variance ratio of PCA components.
- Parameters:
- pcasklearn.decomposition.PCA
Fitted PCA object.
- n_componentsint, optional
Number of principal components to plot. If None, plot all components.
- axmatplotlib.axes.Axes, optional
Axes object to plot on. If None, a new figure and axes are created.
- verbosebool, optional
If True, print explained variance ratios and their cumulative sums.
- Returns:
- axmatplotlib.axes.Axes
Axes object with the plot.
- Raises:
- ImportError
If matplotlib or seaborn are not installed.