feat(plotting): add Makie backend + share case layer via src/PlotCase - #407
Merged
Merged
Conversation
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>
7 tasks
CTBase 0.30.0-beta (Plotting.MakieBackend + CTBaseMakie) is now released. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ocots
marked this pull request as ready for review
August 27, 2026 16:31
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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). LoadCairoMakie/GLMakieandplot(sol)returns aMakie.Figure.Plots.plot(sol)→ Plots,Makie.plot(sol)→ Makie. Samedescriptionand keywords (layout,control,time, the*_stylekeywords,color,size). Loading both meansplotmust be qualified.plotonly.Makie.plot!throwsNotImplemented; 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.PlotCaseThe backend-free plotting logic (vocabulary, gating, panel/decoration builders, layout assembly) moves out of the
CTModelsPlotsextension into a newsrcsubmodule so the Plots and Makie extensions share it. NewPlotCase.build_figureis the single backend-agnostic entry point; the two extensions are thin plumbing that forward keywords and pick arenderbackend.Compatibility
Plots.plot(sol)/plot!(sol)— signatures, keywords, defaults, behaviour unchanged.test_plot_reference.jl(72 assertions) passes with no edits.Base.get_extension(CTModels, :CTModelsPlots).cleanare nowCTModels.PlotCase.clean(see BREAKING.md).[compat] CTBase = "0.30". Version0.18.0 → 0.19.0-beta.Tests
test/suite/plotting/test_plot_build.jl(new, 28):build_figureproduces 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 withCairoMakie(fixtures, description subsets,layout×control, group styles,color/size, axis count, empty figure,plot!→NotImplemented).test_plot.jl(129) andtest_plot_reference.jl(72) green with only the one-line helper repoint.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