Skip to content

Marginal Distribution Plots

Visualize 2D joint distributions with covariance ellipses, marginal density curves, and optional Monte Carlo scatter overlays.

Solver API

plot_estimator_marginal

plot_estimator_marginal(solvers, state_indices=(0, 1), sigma=None, labels=None, colors=None, state_labels=None, scatter_points=None, show_marginals=True, backend='matplotlib', backend_config=None, **kwargs) -> object

Plot 2D covariance ellipses with optional marginals from solved estimators.

Extracts the 2x2 sub-covariance and 2D sub-state from each solver using the given state_indices, then delegates to :func:plot_estimator_marginal_from_arrays.

Parameters:

Name Type Description Default
solvers list

List of solved estimator objects (BatchLeastSquares, ExtendedKalmanFilter, or UnscentedKalmanFilter).

required
state_indices tuple[int, int]

Two state indices to extract. Default: (0, 1).

(0, 1)
sigma float or None

N-sigma level for ellipse scaling. None means only mean markers are drawn. Default: None.

None
labels list[str] or None

Legend label per solver. Default: "Series 0", …

None
colors list[str] or None

Colour per solver. Default: colour cycle.

None
state_labels tuple[str, str] or None

(x_label, y_label) axis labels. Default: ("State 0", "State 1").

None
scatter_points ndarray or None

Shape (N, 2) MC sample overlay. Default: None.

None
show_marginals bool

If True, add marginal density curves on top/right axes. Default: True.

True
backend str

"matplotlib" or "plotly". Default: "matplotlib".

'matplotlib'
backend_config dict or None

Backend-specific configuration.

None
**kwargs dict

Ignored.

{}

Returns:

Type Description
object

Generated matplotlib or plotly figure object.

Array API

plot_estimator_marginal_from_arrays

plot_estimator_marginal_from_arrays(means, covariances, sigma=None, labels=None, colors=None, state_labels=None, scatter_points=None, show_marginals=True, backend='matplotlib', backend_config=None, **kwargs) -> object

Plot 2D covariance ellipses with optional marginal density curves from arrays.

Each entry in means / covariances represents one estimator series. Covariance ellipses are scaled using the chi-squared quantile for the requested sigma level. Optional marginal (1D Gaussian) density curves can be shown on top and right axes.

Parameters:

Name Type Description Default
means list[ndarray]

List of shape-(2,) mean vectors, one per series.

required
covariances list[ndarray]

List of shape-(2, 2) covariance matrices, one per series.

required
sigma float or None

N-sigma level for ellipse scaling. None means only mean markers are drawn (no ellipses or marginals). Default: None.

None
labels list[str] or None

Legend label per series. Default: "Series 0", …

None
colors list[str] or None

Colour per series. Default: colour cycle.

None
state_labels tuple[str, str] or None

(x_label, y_label) axis labels. Default: ("State 0", "State 1").

None
scatter_points ndarray or None

Shape (N, 2) array of Monte Carlo samples overlaid as gray dots. Default: None.

None
show_marginals bool

If True, add marginal density curves on top/right axes. Only used when sigma is not None. Default: True.

True
backend str

"matplotlib" or "plotly". Default: "matplotlib".

'matplotlib'
backend_config dict or None

Backend-specific configuration. Matplotlib keys: figsize. Plotly keys: width, height.

None
**kwargs dict

Ignored (reserved for forward-compatibility).

{}

Returns:

Type Description
object

Generated matplotlib or plotly figure object.


See Also