Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,23 @@ end
# ═══════════════════════════════════════════════════════════════════════════════
# Docstrings from external packages
# ═══════════════════════════════════════════════════════════════════════════════
using JLD2, JSON3, Plots, CairoMakie
using JLD2, JSON3

# plotting
using Plots
import CairoMakie # `import`, not `using`: keeps Makie's `plot`/`plot!` out of Main,
# which would collide with Plots' `plot`/`plot!` in the `@docs` block on results/plot.md

# DocumenterVitepress picks the highest-priority MIME type a plot object responds to
# (image/png: 4.0 over image/svg+xml: 3.0) — the opposite of Documenter.HTML, which
# prefers SVG. Both Plots.jl and CairoMakie respond to `image/png`, so PNG wins for
# every figure unless it is disabled. Set once here, before any @example block runs,
# so it covers every page present or future — not just the ones plotting today. See
# Handbook/VITEPRESS-DOC.md "Plot image format — SVG vs PNG".
Base.showable(::MIME"image/png", ::Plots.Plot) = false
CairoMakie.activate!(; type="svg")
Base.showable(::MIME"image/png", ::CairoMakie.Makie.Figure) = false

const CTModelsJLD = Base.get_extension(CTModels, :CTModelsJLD)
const CTModelsJSON = Base.get_extension(CTModels, :CTModelsJSON)
const CTModelsPlots = Base.get_extension(CTModels, :CTModelsPlots)
Expand Down
3 changes: 1 addition & 2 deletions docs/src/serialization/plotting.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ CurrentModule = CTModels
```@setup plt
using Plots
using CairoMakie: CairoMakie, Makie
Base.showable(::MIME"image/png", ::Plots.Plot) = false
```

When `Plots` is loaded, the `CTModelsPlots` extension adds a recipe so a
Expand Down Expand Up @@ -50,7 +49,7 @@ The recipe accepts keyword arguments that control the arrangement and how the co
displayed:

| Keyword | Values | Effect |
|---|---|---|
| --- | --- | --- |
| `layout` | `:group` / `:split` | one figure per quantity, or state/costate split |
| `control` | `:components` / `:norm` / `:all` | plot each control, its norm, or both |
| `time` | `:default` / `:normalize` | physical time, or rescaled to ``[0, 1]`` |
Expand Down
Loading