Skip to content

Chart Module

daspi.plotlib.chart

High-level chart classes for composing multi-variable figures.

This module provides the Chart class hierarchy. Each chart manages a AxesFacets subplot grid, one or more _CategoryLabel classifiers, a LabelFacets annotation layer, and a StripesFacets reference-mark layer. Users add visual marks by calling chart.plot(PlotterClass, **kwargs) and finalise the figure with chart.label(…) and / or chart.stripes(…).

Class hierarchy

Chart (abstract) Common base containing the DataFrame source and all shared state (feature / hue / shape / size / hue_order columns, axis orientation, figure-size stretching). Defines the plot() abstract method and the label() and stripes() concrete helpers.

SingleChart (extends Chart) One-axes chart. All Plotter calls draw onto the single Axes. Supports categorical-feature dodging via Dodger. Optionally transposes the target axis from y to x.

JointChart (extends Chart) Multi-axes chart where each plot() call selects the next Axes from the AxesFacets grid sequentially. Used by the precast composite charts (e.g. ResidualsCharts, GageRnRCharts) to build fixed-layout multi-panel figures.

MultivariateChart (extends Chart) Faceted grid chart that partitions a DataFrame by one or two categorical grouping columns (row and col) and draws the same plotter sequence in every panel. Designed for comparing distributions or relationships across subgroups in a single call.

Utility functions

check_label_order Validates that a user-supplied hue_order list covers all unique values found in the data; raises AssertionError with a descriptive message otherwise.

Notes

Chart objects implement the context-manager protocol so that a with block can close the figure cleanly if an exception occurs. Chart.save() calls figure.savefig() with tight bounding-box defaults. Both methods also accept keyword arguments forwarded to matplotlib.