Skip to content

fix: match Python figure styling to MATLAB reference#68

Merged
iahncajigas merged 2 commits intomainfrom
fix/match-matlab-figure-styling
Mar 20, 2026
Merged

fix: match Python figure styling to MATLAB reference#68
iahncajigas merged 2 commits intomainfrom
fix/match-matlab-figure-styling

Conversation

@iahncajigas
Copy link
Copy Markdown
Contributor

Summary

  • Matches Python nSTAT figure outputs to the MATLAB reference toolbox styling
  • Fixes core diagnostic plot methods (KSPlot, plotInvGausTrans, plotSeqCorr, plotCoeffs, plotResidual) to use MATLAB-matching colors, fonts, tick formatting, and legend sizing
  • Removes suptitles from all 5 example scripts (MATLAB has none)
  • Matches subplot title strings, axis labels, and font properties exactly to MATLAB
  • Fixes Example 02 displacement/velocity line color to black (was blue)
  • Sets consistent 250 DPI export across all examples
  • Enhances modern plot style with Helvetica font and MATLAB-matching tick parameters

Test plan

  • Run each example script with --export-figures and visually compare with MATLAB reference figures in docs/figures/
  • Verify no suptitles appear on any generated figure
  • Verify KS plot uses black dash-dot diagonal and red CI bands
  • Verify plotInvGausTrans uses solid red CI lines and LaTeX axis labels
  • Run pytest -q to check for regressions

🤖 Generated with Claude Code

Iahn Cajigas and others added 2 commits March 17, 2026 23:05
Core diagnostic plot methods (fit.py):
- KSPlot: black dash-dot diagonal, pure red CI bands, Arial 12pt bold
  labels, legend fontsize 14, explicit tick grid [0,.2,.4,.6,.8,1]
- plotInvGausTrans: solid red CI lines (was gray dashed), LaTeX axis
  labels matching MATLAB (ACF(Φ⁻¹(uₙ)) and Δτ [sec]), legend fontsize 14
- plotSeqCorr: MATLAB-matching axis labels, tick grid, legend fontsize 14
- plotCoeffs: MATLAB-matching title with significance note, y-grid,
  90-degree rotated x-tick labels
- plotResidual: Arial fonts, legend fontsize 14
- All methods: axes linewidth 1, tick length 6px

Plot style (plot_style.py):
- Modern mode now sets Helvetica font on labels and tick labels
- Tick params: length=6, width=1 (matching MATLAB [.02 .02])
- Per-axes legend styling (not just figure-level)

Example scripts (all 5):
- Removed all fig.suptitle() calls to match MATLAB (no figure-level titles)
- Matched subplot title strings exactly to MATLAB (e.g., "Simulated
  Conditional Intensity Function (CIF)", "Cell#N", "Stimulus - Whisker
  Displacement")
- Matched axis labels (λ(t) [Hz], Displacement Velocity [mm/s])
- Added fontname="Arial", fontsize=12, fontweight="bold" to labels
- Fixed Example 02 displacement/velocity to black lines (was blue)
- Fixed Example 04 Cell titles to "Cell#N" format, added axis ticks and
  legend matching MATLAB
- Export DPI set to 250 across all examples (was 150 in some)
- Removed bbox_inches="tight" to preserve figure dimensions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rotate fig05 stimulus-effect surfaces 90° CCW so time [s] is on x-axis
  and Trial [k] is on y-axis, matching MATLAB nSTATPaperExamples_15.png
  and fig03 bottom-panel orientation
- Increase plotCoeffs marker size (8→12), capsize (3→5), linewidth (1→1.5),
  and significance star size (10→14) so all 3 model coefficients are visible
- Add legend to plotCoeffs using lambda dataLabels, matching MATLAB behaviour
- Regenerate affected figure PNGs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@iahncajigas iahncajigas merged commit 1a4c24b into main Mar 20, 2026
14 checks passed
@iahncajigas iahncajigas deleted the fix/match-matlab-figure-styling branch March 20, 2026 03:54
iahncajigas pushed a commit that referenced this pull request Mar 23, 2026
The committed figures were stale — generated before the API parity
and algorithm fixes in PRs #68-73. Regenerate all 6 example05 figures
using the current code. The hybrid filter (fig06) now correctly shows
state detection, movement probability tracking, and decoded trajectories
matching the MATLAB reference output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant