← Back to Autonomy
VS Code Copilot customization kit · figure skills · By Majid Mazouchi

Copilot Plotting Kit
Plate Gallery

Every figure below was rendered by the kit's own scripts on synthetic data — fourteen skills, one style root. Warm cream canvas, deep ink, saturated accents; units in every axis label; semantic colors that never change meaning.

ok / healthy warn / degraded fail / alarm context / de-emphasized

IMatplotlib conventions

Templates and annotation helpers every static figure is built from. Object-oriented API, preset sizes, direct labeling, semantic reference bands.

Plate C-01 fig_templates.py::stacked
2026-06-13T01:24:53.374067 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 2500 3000 3500 Speed [rpm] Aligned stack with reference bands 35 40 45 Iq [A] 0 2 4 6 8 10 Time [s] 65 70 75 80 Temp [degC] Enters warn band at t = 6.3 s
Aligned subplot stack. Three quantities, one shared time axis, one physical unit per axes. Warn and fail bands shaded with semantic tokens; the key moment carries a callout rather than a legend entry.
Plate C-02 fig_templates.py::comparison_bars
2026-06-13T01:24:53.541805 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 50 100 Detection rate [%] Rule-based EKF residual Autoencoder Hybrid (proposed) 71 84 88 96 Detector comparison — hybrid highlighted
Comparison bars. Highlight-one, grey-the-rest: the proposed detector in house blue, alternatives in neutral. Values labeled at the bar tip, zero baseline, no vertical gridlines.

IIDiagnostics plots

Fault detection and isolation visuals: spectra, time-frequency maps, residuals against thresholds, and classifier evaluation under class imbalance.

Plate D-01 spectral.py::plot_spectrum
2026-06-13T01:24:53.893703 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 1 0 1 1 0 2 1 0 3 Frequency [Hz] −60 −50 −40 −30 −20 PSD [dB] 6th harm. Stator current spectrum — emerging 6th harmonic
Welch spectrum with fault markers. dB magnitude with the expected 6th-harmonic location marked as a labeled stem — hypotheses on the plot, not in the legend.
Plate D-02 spectral.py::plot_spectrogram
2026-06-13T01:24:55.834415 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 1 2 3 4 5 6 7 Time [s] 0 200 400 600 800 1000 1200 1400 Frequency [Hz] Fault emergence at t = 4 s −100 −90 −80 −70 −60 −50 PSD [dB]
Spectrogram. Sequential cream-to-blue colormap on the light canvas; the event of interest framed by an ink box. Mesh rasterized inside the SVG to keep files small.
Plate D-03 spectral.py::plot_residual_threshold
2026-06-13T01:24:56.918018 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 1 2 3 4 5 6 7 8 Time [s] 0.00 0.05 0.10 0.15 0.20 0.25 Residual [-] First alarm t = 0.10 s Residual with threshold and alarms Fault injected Residual Threshold Alarm
Residual and threshold. The three mandatory layers: residual, dashed threshold, alarm flags — plus the fault-injection window shaded and first-alarm time called out. Detection delay is THE number.
Plate D-04 classifier_eval.py::plot_confusion
2026-06-13T01:24:57.084341 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ Healthy Bearing Stator Resolver Predicted Healthy Bearing Stator Resolver True 940 97% 18 2% 8 1% 4 0% 22 11% 161 83% 9 5% 3 2% 11 7% 7 4% 142 86% 5 3% 6 6% 2 2% 4 4% 88 88% Fault classifier — count and row recall
Confusion matrix. Raw count and row-normalized recall in every cell; diagonal readable at a glance, text color flips for legibility on dark cells.
Plate D-05 classifier_eval.py::plot_roc_pr
2026-06-13T01:24:57.528053 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 1.0 False positive rate 0.0 0.2 0.4 0.6 0.8 1.0 True positive rate ROC AUC = 0.974 Op. point (thr=0.5) 0.0 0.2 0.4 0.6 0.8 1.0 Recall 0.0 0.2 0.4 0.6 0.8 1.0 Precision Precision-Recall AP = 0.815 Prevalence = 6.1%
ROC and precision-recall pair. Always shown as a pair — at 6% fault prevalence an excellent ROC can hide useless precision. The deployed operating point is marked on both.
Plate D-06 fault_heatmap.py::plot_signature_matrix
2026-06-13T01:24:57.727219 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ r1: Iq ripple r2: 6f harm. r3: speed err r4: Vdc ripple r5: temp drift Symptom / residual Bearing wear Stator ITSC Resolver offset DC-link cap Fault mode · · · · · · · · · · FDI signature structure
FDI signature matrix. Ternary fault-symptom structure: up/down/none glyphs, the isolability of each fault mode visible by row pattern.
Plate D-07 fault_heatmap.py::plot_dtc_occurrence
2026-06-13T01:24:57.987858 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ W1 W2 W3 W4 W5 W6 W7 W8 W9 W10 P0A0F P0A1F P0A2F P0A3F P0A4F P0A5F Peak: 31 DTC occurrence by week 0 5 10 15 20 25 30 Occurrences
DTC occurrence heatmap. Fleet DTC counts over weeks; the peak cell auto-framed and annotated — the figure points at its own anomaly.

IIIPrognostics plots

Remaining useful life, degradation, and reliability. Uncertainty is the product: no bare point estimates, ever.

Plate P-01 rul_fan.py::plot_rul_fan
2026-06-13T01:24:58.221447 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 200 400 600 800 Operating time [h] 0 200 400 600 800 1000 1200 1400 Remaining useful life [h] End of life Bearing RUL with uncertainty fan 90% band 50% band Median RUL True RUL
RUL fan. Median trajectory with nested 50% and 90% bands against ground truth; end-of-life is the dashed crimson floor.
Plate P-02 rul_fan.py::plot_alpha_lambda
2026-06-13T01:24:58.374409 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.2 0.4 0.6 0.8 Life fraction λ [-] 0 200 400 600 800 1000 RUL [h] α-λ accuracy (89% in cone) ±20% cone True RUL Pred (in cone) Pred (out)
Alpha-lambda accuracy. The standard PHM accuracy view: predictions inside the ±20% cone in blue, violations in crimson, in-cone fraction graded in the title.
Plate P-03 degradation.py::plot_health_index
2026-06-13T01:24:58.522335 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 200 400 600 800 1000 Operating time [h] 0.0 0.2 0.4 0.6 0.8 1.0 Health index [-] P — detectable F — functional failure P-F interval = 300 h Health index with P-F interval — unit 17
Health index with P-F interval. Green-amber-red zones as quiet background shading; the P-F window — the maintenance opportunity, and the business case — measured and annotated.
Plate P-04 degradation.py::plot_fleet_spaghetti
2026-06-13T01:24:58.685535 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 200 400 600 800 1000 Operating time [h] 0.2 0.4 0.6 0.8 1.0 Health index [-] Fleet of 25 — unit 7 highlighted Fleet P10–P90 Fleet median Unit 7
Fleet spaghetti. Twenty-five units in neutral grey with a percentile band; one unit of interest in blue. Narrative view of “this vehicle versus the fleet.”
Plate P-05 survival.py::plot_weibull_survival
2026-06-13T01:24:58.939734 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 500 1000 1500 2000 2500 Time to failure [h] 0.0 0.2 0.4 0.6 0.8 1.0 Survival probability R(t) [-] B10 = 496 h B50 = 1071 h Bearing population — survival and B-lives Empirical (n=60) Weibull β=2.45, η=1244 h
Weibull survival. Empirical steps with the fitted curve; B10 and B50 lives dropped to the axes with shape and scale reported in the legend.
Plate P-06 survival.py::plot_hazard
2026-06-13T01:24:59.101907 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 250 500 750 1000 1250 1500 1750 2000 Time [h] 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 Hazard rate h(t) [1/h] Infant Useful life Wear-out Bathtub hazard
Hazard rate. The bathtub, with infant, useful-life, and wear-out phases labeled in place.

IVTime-series telemetry

Vehicle logs at scale. This 400,000-sample log is min-max decimated to ~4,000 points per signal — note the single-sample 140 A spike at t ≈ 90 s that naive striding would have erased.

Plate T-01 multisignal.py::plot_signal_stack
2026-06-13T01:24:59.946715 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 2000 2500 3000 MotSpd [rpm] DTC P0A78 set 400k-sample log — min-max decimated, spike preserved 50 100 IqAct [A] 55 60 65 70 InvTemp [degC] 0 20 40 60 80 100 120 time [s] Init Drive Derate Mode
Decimated signal stack. Aligned stack with a mode lane (enum states as a step plot, not numeric lines) and a DTC event marker spanning all axes. The preserved spike is the proof of the decimator.

VDistributions & SPC

Population comparisons and drift monitoring: the shift-readable ECDF, sorted violins, ridgeline drift, Q-Q honesty checks, and EWMA/CUSUM control charts for fleet features.

Plate X-01 dist_plots.py::plot_ecdf
2026-06-13T01:39:00.064777 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 Iq ripple [A] 0.0 0.2 0.4 0.6 0.8 1.0 Cumulative fraction [-] P90 Population shift after software fix Before fix (SW 21.2) (n=800) After fix (SW 21.4) (n=900)
ECDF comparison. The whole-population answer to “did the fix work?” — every percentile of the after-fix curve sits left of before; P90 marked for the spec conversation.
Plate X-02 dist_plots.py::plot_violin_panel
2026-06-13T01:39:00.226447 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ Plant C (n=300) Plant A (n=300) Plant B (n=300) Plant D (n=300) 1 2 3 4 5 Iq ripple [A] Ripple by assembly plant — sorted by median Overall median = 2.27
Violin panel. Groups sorted by median with n under each violin and the overall median as a dashed reference — plant C is genuinely tighter, plant D genuinely worse.
Plate X-03 dist_plots.py::plot_ridgeline
2026-06-13T01:39:00.359897 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 1 2 3 4 5 Iq ripple [A] SW 21.0 SW 21.1 SW 21.2 SW 21.3 SW 21.4 Distribution drift across releases
Ridgeline drift. Distribution evolution across five software releases, oldest at the bottom; the tail above 4 A visibly disappears.
Plate X-04 dist_plots.py::plot_qq
2026-06-13T01:39:00.495024 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −2 0 2 Theoretical quantiles [-] −10 −5 0 5 10 Sample quantiles [-] Residual normality check — heavy tails visible fit (r=0.970)
Q-Q normality check. Heavy tails depart from the fitted line at both ends — a Gaussian threshold on these residuals would over-alarm. The honesty companion to any threshold figure.
Plate X-05 control_charts.py::plot_ewma
2026-06-13T01:39:00.721431 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 50 100 150 200 250 300 Sample / time 8 9 10 11 12 13 14 Feature mean [A] First signal t = 0 EWMA detects a 0.9σ shift at n = 180 Samples EWMA (λ=0.2) ±3.0σ limits Violation
EWMA control chart. A 0.9σ sustained shift, invisible in the raw samples, signaled 13 points after onset; first violation called out, rule parameters in the title.
Plate X-06 control_charts.py::plot_cusum
2026-06-13T01:39:00.930916 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 50 100 150 200 250 300 Sample / time 0 10 20 30 40 50 60 CUSUM [σ] signal t = 187 CUSUM on the same shift C+ (upward) C− (downward) h = ±5.0σ
CUSUM chart. Both one-sided sums against the decision interval h — the upward sum climbs steadily after the shift while the downward stays flat.

VIMaps & 2D fields

The native visuals of machine calibration and operating analysis — and the home of the kit’s 3D policy: surfaces only where the surface IS the object, always with a contour twin.

Plate M-01 efficiency_map.py::plot_efficiency_map
2026-06-13T01:41:30.149019 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 2000 4000 6000 8000 10000 12000 Speed [rpm] 50 100 150 200 250 300 Torque [Nm] Road load PMSM efficiency map with drive-cycle points 80% 86% 90% 93% 95% 96% Envelope Operating points 70% 73% 77% 80% 84% 87% 91% 94% 97% Efficiency [-]
Efficiency map. Iso-efficiency lines labeled at the business-relevant levels, torque envelope in ink, MTPA→MTPV trajectory direct-labeled, drive-cycle points sized by dwell.
Plate M-02 flux_maps.py::plot_flux_surface
2026-06-13T01:39:01.818927 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −400 −350 −300 −250 −200 −150 −100 −50 0 i_d [A] 0 50 100 150 200 250 300 350 400 i_q [A] 0.04 0.05 0.06 0.07 0.08 ψd [Vs] ψd(i_d, i_q) — saturation and cross-coupling
Flux map surface. Policy-compliant 3D: ψd over the current plane with saturation droop toward the viewer, contour projection on the floor, measurement grid as light edge lines.
Plate M-03 flux_maps.py::plot_flux_contour
2026-06-13T01:39:02.648345 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −400 −350 −300 −250 −200 −150 −100 −50 0 i_d [A] 0 50 100 150 200 250 300 350 400 i_q [A] ψd — mandatory contour twin 0.040 0.044 0.044 0.048 0.052 0.056 0.060 0.064 0.068 0.072 0.076 0.080 0.084 0.036 0.044 0.052 0.060 0.068 0.076 0.084 ψd [Vs]
Contour twin. Same data, measurable form — reviewers read values here. The twin is mandatory for any 3D figure that ships.
Plate M-04 dwell_density.py::plot_dwell_hexbin
2026-06-13T01:39:03.103662 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 2000 4000 6000 8000 10000 12000 14000 Speed [rpm] 0 50 100 150 200 250 300 Torque [Nm] coverage gap Fleet dwell vs capability — 80k samples Envelope 1 0 0 1 0 1 1 0 2 Dwell [samples] (log)
Dwell density. 80,000 fleet operating points as a log-scaled hexbin against the capability envelope; the dashed crimson box flags a region the fleet uses but testing doesn’t cover.

VIIML insights

Model understanding for fault classifiers and fleet segmentation — embeddings that state their method, clustering claims with their silhouette honesty check, and calibration for probabilities that feed maintenance decisions.

Plate L-01 embeddings.py::plot_embedding_clusters
2026-06-13T01:39:03.813277 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −15 −10 −5 0 5 10 15 PC1 (60% var) −10 −5 0 5 10 PC2 (24% var) Bearing-like Healthy core Stator-like Mixed Fault-mode discovery — PCA + k-means Bearing-like (n=222) Healthy core (n=225) Stator-like (n=228) Mixed (n=225)
Embedding clusters. PCA scatter with convex hulls and per-cluster n; axes labeled with explained variance so the projection is falsifiable.
Plate L-02 embeddings.py::plot_silhouette
2026-06-13T01:39:04.019308 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 Silhouette coefficient [-] 0 1 2 3 Clustering quality — silhouette Mean = 0.64
Silhouette plot. Per-cluster coefficient profiles against the mean — the mandatory companion to any clustering claim; thin or negative clusters are visible immediately.
Plate L-03 correlation.py::plot_corr_clustered
2026-06-13T01:39:04.447290 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ Vdc ripple Coolant flow Inv temp Stator temp Mileage Speed err Iq ripple 6f harmonic Vdc ripple Coolant flow Inv temp Stator temp Mileage Speed err Iq ripple 6f harmonic -0.67 -0.62 -0.67 0.87 -0.62 0.87 0.49 0.45 0.49 0.81 0.45 0.81 Feature correlation — clustered order −1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00 Pearson r [-]
Clustered correlation. Features reordered by hierarchical clustering so correlated blocks emerge — the electrical-signature block and the thermal block separate cleanly; weak cells washed out.
Plate L-04 importance.py::plot_feature_importance
2026-06-13T01:39:04.713672 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.00 0.02 0.04 0.06 0.08 0.10 Permutation importance [-] Charge cycles SOC window Ambient temp Mileage Coolant Δp Vdc ripple Speed err Stator temp slope Iq ripple 6f harmonic What drives the stator-fault score
Feature importance. Sorted bars with cross-fold spread, top-5 in blue, the rest neutral; the method is named because gain, permutation, and SHAP rank differently.
Plate L-05 importance.py::plot_calibration
2026-06-13T01:39:04.899120 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.5 1.0 Observed fault fraction [-] Calibration (ECE = 0.097) Perfect Model 0.00 0.25 0.50 0.75 1.00 Predicted probability [-]
Calibration diagram. Reliability curve with ECE self-graded in the title and the prediction histogram as a quiet strip — for probabilities driving maintenance, calibration beats AUC.

VIIIFlows & relations

How totals decompose, volumes flow, and faults propagate. The waterfall is the canonical executive ROI exhibit; the DAG renderer refuses cycles by design.

Plate F-01 waterfall.py::plot_waterfall
2026-06-13T01:39:05.039148 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ Avoided recalls Warranty triage Unplanned downtime Platform cost Data/cloud opex Net annual 0 2 4 6 8 Value [$M/yr] +4.6 +2.1 +1.9 -1.2 -0.6 6.8 VHM program ROI decomposition
ROI waterfall. Gains in green largest-first, costs in crimson, net anchored in slate — the one-figure version of a program pitch. Exec-polish checklist applies by default.
Plate F-02 dag_graph.py::plot_layered_dag
2026-06-13T01:39:05.194848 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ Fault propagation — FMEA view (edge width = occurrence) Bearing wear root cause Rotor imbalance root cause Vibration ↑ symptom Iq ripple ↑ symptom Temp rise symptom NVH complaint effect Derate event effect DTC P0A78 effect
Layered causal DAG. Root causes → symptoms → effects, layered by causal depth; edge width encodes occurrence. Accent semantics match the rest of the kit.
Plate F-03 parallel_coords.py::plot_parallel
2026-06-13T01:39:05.735440 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 47.8 -9.42 Ambient [degC] 1 0.0499 Load factor 1 0 SOC swing 12 0 Fast charges/wk 110 -27.2 Mileage [kkm] Conditions of failed units vs fleet Failed = yes (n=97) Other (n=1103, shown 400)
Parallel coordinates. Failed units in blue against a subsampled grey fleet across five normalized axes with real-unit endpoints — the failure population runs hotter, harder, and charges faster.

IXSVG diagrams

Conceptual figures — built from grid-snapped primitives, text stays selectable text. Accent semantics match the charts: blue plant, teal estimation, orange evaluation, crimson decision.

Plate S-01 svg_primitives.py::Diagram
Model-based FDI loop Plant PMSM + inverter Observer EKF residual gen. Residual eval. threshold + CUSUM Fault decision isolation logic y(t) u(t) y(t) r(t) J(r) to vehicle
Model-based FDI loop. Blocks, labeled arrows, and consistent color meaning. Data charts get matplotlib; structure gets this.

XTables and KPI cards

Live HTML, not screenshots — the same tokens as the charts. Status cells use tinted fills with a colored left border; one heat-shaded column ranks the table.

Plate TB-01 styled_tables.py::kpi_cards · df_to_html_table
Fleet coverage
94%
+6 pts vs Q1
False alarms
2.1/Mh
−38%
Avoided downtime
$1.4M
+$0.3M
Table 1 — Detector performance by fault mode (validation fleet).
Fault modeDetection rateFAR [1/Mh]Median horizon [h]Status
Bearing wear0.961.20310Pass
Stator ITSC0.913.40120Pass
Resolver offset0.990.40540Pass
DC-link cap0.836.8045Review
Executive KPI strip and detector table. Seven-row ceiling, right-aligned tabular numerals, em-dash for missing values, caption under the table.

XIInteractive (plotly)

These plates degrade gracefully: a static SVG twin renders everywhere (including offline file previews); when the page is online and plotly.js loads, each upgrades in place to the fully interactive chart — hover, zoom, unified tooltips.

Plate I-01 plotly_theme.py::timeseries · add_threshold
2026-06-13T01:44:57.183645 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 2600 2800 3000 3200 3400 speed [rpm] Overspeed limit Telemetry — static twin 0 10 20 30 40 50 60 t [s] 38 40 42 44 46 iq [A]
Interactive telemetry. Unified hover with units, overspeed limit as a labeled semantic line. Shown as its static twin until plotly.js loads, then upgraded in place.
Plate I-02 sankey_flow.py::build_sankey
2026-06-13T01:44:57.388953 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 2000 4000 6000 8000 10000 Vehicles per year Telemetry triage 8,200 Dealer diagnosis 3,100 Routing Software fix (OTA) 5,200 Component repair 3,700 No fault found 1,600 Recall scope 800 Outcome DTC resolution flow — static twin (11,300 veh/yr total)
DTC resolution Sankey. Stage-colored nodes, links at 30% alpha of their source, volumes in the hover. Flows under 2% of total are grouped before plotting.
Plate I-03 fleet_geo.py::plot_state_choropleth
2026-06-13T01:44:57.649921 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 2 4 6 8 10 12 14 DTC rate [1/1k veh/yr] CA NV NC GA TN FL TX AZ MN PA NY WA MA OH MI CO WI IN IL OR 5.5 7.0 7.5 7.6 8.5 9.0 9.1 (n<200) 9.5 11.1 11.3 11.7 12.5 12.5 12.6 12.9 13.1 13.4 13.5 13.6 13.8 fleet mean 11.1 DTC rate by state — static twin (ranked) Cold climate Other
Fleet DTC rate choropleth. Rates normalized by vehicles in operation — never raw counts; states under the minimum-n threshold greyed out. The cold-climate pattern is the hypothesis on display.