Estimation Plots¶
Brahe provides estimation-specific plotting functions for visualizing filter performance: state estimation errors with \(n\sigma\) covariance bounds, state values with uncertainty patches, measurement residuals (prefit, postfit, and RMS), and marginal distributions with covariance ellipses. All functions support multiple solver overlays for comparing filters, configurable grid layouts, and both matplotlib and plotly backends.
Switching Backends
All estimation plot functions accept a backend= parameter. Use backend="plotly" for interactive exploration and backend="matplotlib" for publication-quality static figures.
State Error Grid¶
The state error grid shows the difference between estimated and true state values across all state components. When a sigma level is provided, covariance-derived uncertainty bands indicate the filter's confidence — if the error stays within the bounds, the filter is consistent.
Interactive State Error Grid (Plotly)¶
Plot Source
Static State Error Grid (Matplotlib)¶
Plot Source
The 2x3 grid layout (configurable via ncols) shows each state component in its own subplot. The error line should converge toward zero as the filter processes more observations. Covariance bands that shrink over time indicate the filter is gaining confidence in its estimate.
Comparing Filters (EKF vs UKF)¶
To compare multiple filters on the same grid, pass a list of solvers. This example runs both an EKF and UKF on identical observation data and overlays their state errors:
Plot Source
| estimation_ekf_ukf_comparison_plotly.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
Plot Source
| estimation_ekf_ukf_comparison_matplotlib.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
State Value Grid¶
The state value grid plots the actual estimated state values with a dashed truth reference line. Optional uncertainty patches show the \(\pm n\sigma\) envelope around the estimate — useful for seeing how the estimated trajectory tracks the truth.
Interactive State Value Grid (Plotly)¶
Plot Source
Static State Value Grid (Matplotlib)¶
Plot Source
Measurement Residuals¶
Residual plots show how well the estimated state explains the observations. Pre-fit residuals (\(\mathbf{z} - h(\hat{\mathbf{x}}^-)\)) reflect the prediction quality; post-fit residuals (\(\mathbf{z} - h(\hat{\mathbf{x}}^+)\)) show how much unexplained measurement error remains after the update. When residual_type="both", prefit and postfit are overlaid with distinct colors and marker styles for direct visual comparison. Sequential filters (EKF, UKF) show the clearest prefit/postfit separation since each observation has a distinct predict→update step.
Interactive Residual Plot (Plotly)¶
Plot Source
Static Residual Plot (Matplotlib)¶
Plot Source
RMS Residuals¶
The RMS residual view compresses per-component residuals into a single scalar per epoch — the root mean square across all measurement components. This is useful for tracking overall measurement fit quality over time.
Plot Source
Plot Source
Marginal Distributions¶
The marginal distribution plot shows the joint uncertainty between two state components as a covariance ellipse, with optional marginal density curves on the top and right axes. This visualization is useful for understanding correlation structure and comparing uncertainty representations from different estimation methods. The scatter_points parameter overlays Monte Carlo samples for visual comparison against the analytical covariance ellipse.
Interactive Marginal Plot (Plotly)¶
Plot Source
Static Marginal Plot (Matplotlib)¶
Plot Source
The state_indices parameter selects which pair of state components to visualize — for example, (0, 1) for X-Y position or (3, 4) for Vx-Vy velocity.
See Also¶
- Estimation State Plots API -- Full function signatures and parameters
- Measurement Residual Plots API -- Residual plot reference
- Marginal Distribution Plots API -- Marginal plot reference
- Extended Kalman Filter -- EKF setup and usage
- Batch Least Squares -- BLS diagnostics and residuals
- Plotting Overview -- Backend system and general plotting guide