Skip to content

Commit aa6a03c

Browse files
Format plot title in docs (#268)
* Format plot title in docs * fix typo * add Printf to docs/Project.toml
1 parent 798de89 commit aa6a03c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelog = "5217a498-cd5d-4ec6-b8c2-9b85a09b6e3e"
33
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
44
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
55
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
6+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
67
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
78
SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240"
89
TrixiBase = "9a0f1c46-06d5-4909-a5a3-ce25d3fa3284"
@@ -12,6 +13,7 @@ Changelog = "1"
1213
Documenter = "1"
1314
OrdinaryDiffEqTsit5 = "1"
1415
Plots = "1.9"
16+
Printf = "1"
1517
SparseArrays = "1"
1618
SummationByPartsOperators = "0.5.41"
1719
TrixiBase = "0.1.1"

docs/src/basic_example.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ After running the simulation, the results can be visualized using [Plots.jl](htt
118118
plot the solution at the final time by calling `plot` on a `Pair` of the `Semidiscretization` and the corresponding `ODESolution` `sol`. The result is depicted in the following picture.
119119

120120
```@example overview
121-
using Plots
122-
# default( grid=true, box=:on, dpi=100, titlefont=font(16), linewidth=3, gridlinewidth=2, markersize=4, markerstrokewidth=2, xtickfontsize=14, ytickfontsize=14, xguidefontsize=16, yguidefontsize=16, ztickfontsize=14, zguidefontsize=16, legendfontsize=14) # hide
123-
plot(semi => sol)
121+
using Plots, Printf
122+
# default(grid=true, box=:on, dpi=100, titlefont=font(16), linewidth=3, gridlinewidth=2, markersize=4, markerstrokewidth=2, xtickfontsize=14, ytickfontsize=14, xguidefontsize=16, yguidefontsize=16, ztickfontsize=14, zguidefontsize=16, legendfontsize=14) # hide
123+
plot(semi => sol, plot_title = @sprintf "BBM-BBM equations at t = %.2f" last(tspan))
124124
savefig("shoaling_solution.png") # hide
125125
nothing # hide
126126
```
@@ -135,7 +135,8 @@ Plotting an animation over time can, e.g., be done by the following command, whi
135135

136136
```@example overview
137137
anim = @animate for step in 1:length(sol.u)
138-
plot(semi => sol, plot_initial = true, conversion = waterheight_total, step = step, xlims = (-50, 20), ylims = (-0.8, 0.1))
138+
plot(semi => sol, plot_initial = true, conversion = waterheight_total, step = step, xlims = (-50, 20), ylims = (-0.8, 0.1),
139+
plot_title = @sprintf "BBM-BBM equations at t = %.2f" sol.t[step])
139140
end
140141
gif(anim, "shoaling_solution.gif", fps = 25)
141142
nothing # hide

0 commit comments

Comments
 (0)