Skip to content

Commit e8c2889

Browse files
committed
docs: add setup block to plotting guide to suppress image output in examples
Add @setup plot block that loads Plots and disables image/png showable to prevent inline rendering in docs. Update render example text to note that the ExtensionError cannot be demonstrated because Plots is loaded by make.jl. Move the render(fig) example after the explanatory text.
1 parent 349b420 commit e8c2889

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

docs/src/guide/plotting.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
CurrentModule = CTBase
55
```
66

7+
```@setup plot
8+
using Plots
9+
Base.showable(::MIME"image/png", ::Plots.Plot) = false
10+
```
11+
712
The [`CTBase.Plotting`](@ref) submodule is a generic, domain-free plotting engine.
813
It manipulates a backend-agnostic **intermediate representation** (IR): a weighted
914
tree of titled axes carrying series and decorations. The engine knows nothing about
@@ -178,19 +183,16 @@ a `Figure` onto an existing backend target, targeting cells by the deterministic
178183
leaf order (see [`leaves`](@ref)).
179184

180185
Without a backend loaded, the fallback throws an
181-
[`CTBase.Exceptions.ExtensionError`](@ref):
186+
[`CTBase.Exceptions.ExtensionError`](@ref). This cannot be demonstrated
187+
in these docs because `Plots` is loaded by `make.jl` to produce the
188+
examples below, which causes the `CTBasePlots` extension to be active.
189+
190+
Once `Plots` is loaded, `render(fig)` produces a Plots.jl plot:
182191

183192
```@example plot
184-
fig2 = CTBase.Plotting.Figure(CTBase.Plotting.Leaf(ax))
185-
try # hide
186-
CTBase.Plotting.render(fig2)
187-
catch e # hide
188-
showerror(IOContext(stdout, :color => false), e) # hide
189-
end # hide
193+
CTBase.Plotting.render(fig)
190194
```
191195

192-
Once `Plots` is loaded, `render(fig)` produces a Plots.jl plot.
193-
194196
## Leaf Traversal
195197

196198
[`leaves`](@ref) returns the `Leaf` nodes of a layout tree in deterministic

0 commit comments

Comments
 (0)