Plotting¶
scree_plot ¶
Plot explained variance ratio per component (scree plot).
Args:
model: A fitted VBPCA instance.
ax: Optional matplotlib Axes to draw on. A new figure is
created when None.
cumulative: If True, overlay a cumulative variance line.
Returns:
The matplotlib Figure containing the plot.
Raises: RuntimeError: If the model has not been fitted or lacks explained-variance information.
loadings_barplot ¶
loadings_barplot(model: VBPCA, component: int = 0, *, ax: Axes | None = None, top_n: int | None = None, feature_names: list[str] | None = None) -> Figure
Bar plot of loadings (weights) for a single component.
Args:
model: A fitted VBPCA instance.
component: Zero-based component index.
ax: Optional matplotlib Axes.
top_n: If set, show only the top_n features by absolute loading.
feature_names: Optional labels for the feature axis.
Returns:
The matplotlib Figure containing the plot.
Raises: RuntimeError: If the model has not been fitted.
variance_explained_plot ¶
Plot per-component explained variance (absolute, not ratio).
Args:
model: A fitted VBPCA instance.
ax: Optional matplotlib Axes.
Returns:
The matplotlib Figure containing the plot.
Raises: RuntimeError: If the model has not been fitted or lacks explained-variance information.