Skip to content

Commit ecc0e59

Browse files
use postprocessing to get HTML figures
1 parent 9b1d77a commit ecc0e59

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

docs/make.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ examples = [
1515
"triangle.jl",
1616
]
1717

18+
function uncomment_objects(str)
19+
str = replace(str, "###```@raw" => "```\n\n```@raw")
20+
str = replace(str, "###<object" => "<object")
21+
str = replace(str, "###```\n```" => "```")
22+
str
23+
end
24+
1825
for example in examples
1926
example_filepath = joinpath(EXAMPLES_DIR, example)
20-
Literate.markdown(example_filepath, OUTPUT_DIR; execute=true)
27+
Literate.markdown(example_filepath, OUTPUT_DIR; execute=true, postprocess = uncomment_objects)
2128
end
2229

2330
makedocs(
2431
doctest = false,
25-
format = Documenter.HTML(assets = [asset("https://cdn.plot.ly/plotly-1.54.7.js")]),
32+
format = Documenter.HTML(),
2633
sitename = "FastTransforms.jl",
2734
authors = "Richard Mikael Slevinsky",
2835
pages = Any[

examples/disk.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
# [documentation](https://MikaelSlevinsky.github.io/FastTransforms).
2121

2222
using FastTransforms, LinearAlgebra, Plots
23+
const GENFIGS = joinpath(dirname(dirname(pathof(FastTransforms))), "docs/src/generated")
24+
!isdir(GENFIGS) && mkdir(GENFIGS)
2325
plotlyjs()
2426

2527
# Our function $f$ on the disk:
@@ -41,8 +43,12 @@ F = [f(r*cospi(θ), r*sinpi(θ)) for r in r, θ in θ]
4143
# We superpose a surface plot of $f$ on top of the grid:
4244
X = [r*cospi(θ) for r in r, θ in θ]
4345
Y = [r*sinpi(θ) for r in r, θ in θ]
44-
scatter3d(vec(X), vec(Y), vec(0F); markersize=0.75, markercolor=:red, size=(1000, 1000))
46+
scatter3d(vec(X), vec(Y), vec(0F); markersize=0.75, markercolor=:red, size=(800, 600))
4547
surface!(X, Y, F; legend=false, xlabel="x", ylabel="y", zlabel="f")
48+
savefig(joinpath(GENFIGS, "zernike.html"))
49+
###```@raw html
50+
###<object type="text/html" data="../zernike.html" style="width:100%;height:600px;"></object>
51+
###```
4652

4753
# We precompute a (generalized) Zernike--Chebyshev×Fourier plan:
4854
α, β = 0, 0
@@ -95,8 +101,12 @@ F = [f(x[n], w[n]*z) for n in 1:N, z in z]
95101
# We superpose a surface plot of $f$ on top of the grid:
96102
X = [x for x in x, z in z]
97103
Y = [w*z for w in w, z in z]
98-
scatter3d(vec(X), vec(Y), vec(0F); markersize=0.75, markercolor=:green, size=(1000, 1000))
104+
scatter3d(vec(X), vec(Y), vec(0F); markersize=0.75, markercolor=:green, size=(800, 600))
99105
surface!(X, Y, F; legend=false, xlabel="x", ylabel="y", zlabel="f")
106+
savefig(joinpath(GENFIGS, "dunklxu.html"))
107+
###```@raw html
108+
###<object type="text/html" data="../dunklxu.html" style="width:100%;height:600px;"></object>
109+
###```
100110

101111
# We precompute a Dunkl-Xu--Chebyshev plan:
102112
P = plan_rectdisk2cheb(F, β)

0 commit comments

Comments
 (0)