plot_explained_variance_ratio#

ktch.plot.plot_explained_variance_ratio(pca, n_components=None, ax=None, verbose=False)[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.