Plotting: scorequant.plotting¶
scorequant.plotting is a convenience, not part of the stable API: its figures, layout and
signatures may change in any release. Code that must keep working should draw from the documented
result fields instead. Matplotlib is optional and imported only when one of these functions is
called; install the viz extra or synchronize all development extras.
plot_partition is a geometric view and therefore accepts only effective rank one or two. For
higher rank, plot_summary uses a projection-free retained-eigenvalue spectrum, and
plot_optimization summarizes center displacement norms across every informative coordinate.
plot_optimization ¶
plot_optimization(trace: OptimizationTrace) -> Figure
Plot objective, hard retention, occupancies, and center motion.
Parameters:
-
trace(OptimizationTrace) –Aggregate optimization history from a fitted result.
Returns:
-
Figure–Four-panel optimization summary.
plot_partition ¶
plot_partition(
result: QuantizerResult,
scores: ArrayLike,
weights: ArrayLike | None = None,
) -> Figure
Plot observations in the fitted informative coordinate system.
Parameters:
-
result(QuantizerResult) –Fitted score-space partition.
-
scores(ArrayLike) –Raw score matrix compatible with
result. -
weights(ArrayLike | None, default:None) –Optional weights used only to scale marker sizes.
Returns:
-
Figure–One- or two-dimensional partition view.
Raises:
-
ContractError–If the fitted informative space has rank above two. Use :func:
plot_summaryfor a projection-free diagnostic instead.
plot_information ¶
plot_information(report: InformationReport) -> Figure
Plot retained information, its spectrum, and bin occupancy.
Parameters:
-
report(InformationReport) –Information report for one fixed partition and sample.
Returns:
-
Figure–Matrix, eigenvalue, and weighted-occupancy panels. The matrix uses a signed scale so negative off-diagonal values remain visible.
plot_summary ¶
plot_summary(
result: QuantizerResult,
scores: ArrayLike,
weights: ArrayLike | None = None,
) -> Figure
Create a compact final-partition and optimization summary.
Parameters:
-
result(QuantizerResult) –Fitted score-space partition.
-
scores(ArrayLike) –Raw score matrix compatible with
result. -
weights(ArrayLike | None, default:None) –Optional evaluation weights.
Returns:
-
Figure–Partition, retained matrix, trace, and occupancy panels.