Skip to content

feat(plotting): add Makie backend + share case layer via src/PlotCase - #407

Merged
ocots merged 4 commits into
mainfrom
feat/plotting-makie
Aug 27, 2026
Merged

ocots merged 4 commits into
mainfrom
feat/plotting-makie

Conversation

@ocots

@ocots ocots commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Closes #366 (Phase 5 of the plot-engine roadmap). Depends on CTBase 0.30.0-beta (control-toolbox/CTBase.jl#539, merged & released).

What

New Makie backend

  • ext/CTModelsMakie.jl — weak-dependency extension (trigger: Makie). Load CairoMakie / GLMakie and plot(sol) returns a Makie.Figure.
  • Backend chosen by which package is loaded: Plots.plot(sol) → Plots, Makie.plot(sol) → Makie. Same description and keywords (layout, control, time, the *_style keywords, color, size). Loading both means plot must be qualified.
  • Proof of concept: plot only. Makie.plot! throws NotImplemented; the Makie backend does not draw reference lines yet and renders constant controls as lines. Parity tracked in [Roadmap] Makie backend — parity with the Plots backend #408.

Case layer moved to src/CTModels.PlotCase

The backend-free plotting logic (vocabulary, gating, panel/decoration builders, layout assembly) moves out of the CTModelsPlots extension into a new src submodule so the Plots and Makie extensions share it. New PlotCase.build_figure is the single backend-agnostic entry point; the two extensions are thin plumbing that forward keywords and pick a render backend.

Compatibility

  • Plots.plot(sol) / plot!(sol) — signatures, keywords, defaults, behaviour unchanged. test_plot_reference.jl (72 assertions) passes with no edits.
  • Internal: helpers previously reached via Base.get_extension(CTModels, :CTModelsPlots).clean are now CTModels.PlotCase.clean (see BREAKING.md).
  • [compat] CTBase = "0.30". Version 0.18.0 → 0.19.0-beta.

Tests

  • test/suite/plotting/test_plot_build.jl (new, 28): build_figure produces the right IR with no backend loaded — leaf counts, description subsets, control layouts, time/bound decorations, free-final-time markers, normalization.
  • test/suite/extensions/test_plot_makie.jl (new, 41): Makie.plot(sol, …) end-to-end matrix with CairoMakie (fixtures, description subsets, layout × control, group styles, color/size, axis count, empty figure, plot! → NotImplemented).
  • test_plot.jl (129) and test_plot_reference.jl (72) green with only the one-line helper repoint.
  • Full suite green against CTBase 0.30.0-beta: 75152 passing (Aqua + JET included).

Follow-up

Parity issue #408: Makie decorations, :steppost/:scatter, z_order, render!/plot!, non-series kwargs, docs with rendered examples, and a CTFlows Makie case layer.

🤖 Generated with Claude Code

Adds the `CTModelsMakie` weak-dependency extension (trigger: `Makie`): load a
Makie backend package (`CairoMakie`, `GLMakie`, …) and `plot(sol)` renders a
`Makie.Figure`. The backend is chosen by which package is loaded — `Plots.plot`
→ Plots, `Makie.plot` → Makie — with identical `description` and keyword
arguments. Proof of concept for #366: `plot` only
(`plot!` throws `NotImplemented`; reference lines and step controls deferred to
the parity follow-up).

To share the domain logic between the two extensions, the backend-free plotting
case layer (vocabulary, gating, panel/decoration builders, layout assembly)
moves from the `CTModelsPlots` extension into a new `src` submodule
`CTModels.PlotCase`, which also gains `build_figure` — the single
backend-agnostic entry point that both extensions call before handing the
`CTBase.Plotting.Figure` to a concrete `render` backend.

`Plots.plot(sol)` / `plot!(sol)` behaviour, signatures and defaults are
unchanged (frozen by test_plot_reference.jl).

Requires CTBase >= 0.30 (Plotting.MakieBackend + CTBaseMakie); [compat] widened
to "0.29, 0.30" for this beta. Version 0.18.0 -> 0.19.0-beta.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ocots ocots added enhancement New feature or request run ci Trigger the CI workflow on this PR run documentation Trigger the Documentation workflow on this PR roadmap labels Aug 27, 2026
CTBase 0.30.0-beta (Plotting.MakieBackend + CTBaseMakie) is now released.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ocots
ocots marked this pull request as ready for review August 27, 2026 16:31
ocots and others added 2 commits August 27, 2026 21:42
The docs build resolves the docs/ environment separately; its CTBase compat
still pinned 0.29 and blocked the Makie backend.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ocots
ocots merged commit 78f6ff6 into main Aug 27, 2026
10 checks passed
@ocots
ocots deleted the feat/plotting-makie branch August 27, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request roadmap run ci Trigger the CI workflow on this PR run documentation Trigger the Documentation workflow on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Roadmap] Add Makie.jl plotting backend

1 participant