TransformationPlots.saturation_curves#
- TransformationPlots.saturation_curves(curves, original_scale=True, n_samples=10, hdi_prob=0.94, random_seed=None, apply_cost_per_unit=True, idata=None, dims=None, figsize=None, backend=None, return_as_pc=False, scatter_kwargs=None, hdi_kwargs=None, mean_curve_kwargs=None, sample_curves_kwargs=None, **pc_kwargs)[source]#
Overlay saturation curves with posterior sample lines and HDI bands.
Renders a scatter plot of observed data, posterior sample curves, and a credible interval band for each channel panel.
The
curvesy-values are plotted as-is — this function does not rescale them. Pass curves whose scale matches theoriginal_scaleflag so they align with the scatter plot:original_scale=True(default) — pass curves generated withmmm.sample_saturation_curve(original_scale=True)so that y-values are already in original (un-scaled) units.original_scale=False— pass curves frommmm.saturation.sample_curve(...)ormmm.sample_saturation_curve(original_scale=False)(model- internal scaled space).
A heuristic warning is emitted when the curve magnitude appears inconsistent with the requested scale.
- Parameters:
- curves
xr.DataArray Posterior-predictive saturation curves. Typical sources:
mmm.sample_saturation_curve(original_scale=True)— curves already in original scale (use withoriginal_scale=True).mmm.sample_saturation_curve(original_scale=False)ormmm.saturation.sample_curve(params)— curves in scaled space (use withoriginal_scale=False).
Expected dims:
(chain, draw, channel, [custom_dims], x).- original_scalebool, default
True Controls the scatter-plot scale (contributions). The caller must ensure
curvesare in the matching scale.- n_samples
int, default 10 Number of posterior sample curves to draw per panel. Set to 0 to disable sample curves.
- hdi_prob
floatorNone, default 0.94 Credible interval probability for the HDI band. Set to None to disable HDI band rendering.
- random_seed
np.random.Generator, optional RNG for reproducible sample selection.
- apply_cost_per_unitbool, default
True If True and cost-per-unit data is available, the x-axis shows spend.
- idata
az.InferenceData, optional Override instance data.
- dims
dict, optional Dimension filters.
- figsize
tuple[float,float], optional Convenience shorthand for figure size.
- backend
str, optional Rendering backend.
- return_as_pcbool, default
False Return
PlotCollectioninstead of matplotlib tuple.- scatter_kwargs
dict, optional Extra keyword arguments forwarded to the scatter visual (
azp.visuals.scatter_xy).- hdi_kwargs
dict, optional Extra keyword arguments forwarded to the HDI band visual (
azp.visuals.fill_between_y).- mean_curve_kwargs
dict, optional Extra keyword arguments forwarded to the mean curve visual (
azp.visuals.line_xy).- sample_curves_kwargs
dict, optional Extra keyword arguments forwarded to each sample curve visual (
azp.visuals.line_xy).- **pc_kwargs
Forwarded to
PlotCollection.wrap().
- curves
- Returns:
tuple[Figure,NDArray[Axes]] orPlotCollection