Skip to content

Commit 83a1ee8

Browse files
committed
Remove loading of images
1 parent 4c46ee8 commit 83a1ee8

8 files changed

Lines changed: 20 additions & 433 deletions

File tree

docs/src/howto/Materials.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,16 @@ should scale with the absorptance of the tile.
8989
α = 1.0 .- τ .- ρ
9090
pl = scatter(α, irradiance, ylabel = "Irradiance", xlabel = "Absorptance", legend = false)
9191
Plots.abline!(pl, 1.0, 0.0)
92-
savefig(pl, "absorptance_vs_irradiance.png") ## hide
9392
```
9493

95-
![](absorptance_vs_irradiance.png)
96-
9794
Finally, let's scale the colors of each triangle by the irradiance absorbed by each triangle
9895
assuming different shades of green and let's visualize them by turning of the shader in the
9996
renderer to get the exact colors we specify.
10097

10198
```julia
10299
tile.colors = RGB.(0.0, α, 0.0)
103100
sc = Scene(g)
104-
pl = render(sc, wireframe = true, shading = GLMakie.NoShading)
105-
GLMakie.save("tile.png", pl) ## hide
106-
107-
#![](tile.png)
101+
render(sc, wireframe = true, shading = GLMakie.NoShading)
108102
```
109103

110104
---

docs/src/tutorials/from_tree_forest/forest.md

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,15 @@ relative growth rate:
181181
```julia
182182
growths = rand(LogNormal(-2, 0.3), 10, 10)
183183
histogram(vec(growths))
184-
savefig("growths.png") ## hide
185184
```
186185

187-
![](growths.png)
188-
189186
And for the budbreak parameter:
190187

191188
```julia
192189
budbreaks = rand(Beta(2.0, 10), 10, 10)
193190
histogram(vec(budbreaks))
194-
savefig("budbreaks.png") ## hide
195191
```
196192

197-
![](budbreaks.png)
198-
199193
Now we can create our forest by calling the `create_tree` function we defined earlier
200194
with the correct inputs per tree:
201195

@@ -226,23 +220,17 @@ And we can render the forest with the function `render` as in the binary tree
226220
example but passing the whole forest at once
227221

228222
```julia
229-
pl = render(Scene(newforest))
230-
GLMakie.save("newforest1.png", pl) ## hide
223+
render(Scene(newforest))
231224
```
232225

233-
![](newforest1.png)
234-
235226
If we iterate 4 more iterations we will start seeing the different individuals
236227
diverging in size due to the differences in growth rates
237228

238229
```julia
239230
newforest = [simulate(tree, getInternode, 15) for tree in newforest];
240-
pl = render(Scene(newforest))
241-
GLMakie.save("newforest2.png", pl) ## hide
231+
render(Scene(newforest))
242232
```
243233

244-
![](newforest2.png)
245-
246234
## Multithreaded simulation
247235

248236
In the previous section, the simulation of growth was done sequentially, one tree
@@ -258,12 +246,9 @@ newforest = deepcopy(forest)
258246
@threads for i in 1:length(forest)
259247
newforest[i] = simulate(forest[i], getInternode, 6)
260248
end
261-
pl = render(Scene(newforest, parallel = true))
262-
GLMakie.save("newforest3.png", pl) ## hide
249+
render(Scene(newforest, parallel = true))
263250
```
264251

265-
![](newforest3.png)
266-
267252
An alternative way to perform the simulation is to have an outer loop for each timestep and an internal loop over the different trees. Although this approach is not required for this simple model, most FSP models will probably need such a scheme as growth of each individual plant will depend on competition for resources with neighbouring plants. In this case, this approach would look as follows:
268253

269254
```julia
@@ -273,12 +258,9 @@ for step in 1:15
273258
newforest[i] = simulate(newforest[i], getInternode, 1)
274259
end
275260
end
276-
pl = render(Scene(newforest, parallel = true))
277-
GLMakie.save("newforest4.png", pl) ## hide
261+
render(Scene(newforest, parallel = true))
278262
```
279263

280-
![](newforest4.png)
281-
282264
# Customizing the scene
283265

284266
Here we are going to customize the scene of our simulation by adding a horizontal tile represting soil and
@@ -318,12 +300,9 @@ Howver, it may be distracting for the visualization. It turns out that we can tu
318300
`axes = false`:
319301

320302
```julia
321-
pl = render(scene, axes = false)
322-
GLMakie.save("newforest5.png", pl) ## hide
303+
render(scene, axes = false)
323304
```
324305

325-
![](newforest5.png)
326-
327306
We may also want to save a screenshot of the scene. For this, we need to store the output of the `render` function.
328307
We can then resize the window rendering the scene, move around, zoom, etc. When we have a perspective that we like,
329308
we can run the `save_scene` function on the object returned from `render`. The argument `resolution` can be adjusted in both

docs/src/tutorials/from_tree_forest/growthforest.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,11 @@ sink_strength(leaf, vars) = leaf.age > vars.leaf_expansion ? 0.0 :
245245
pdf(leaf.sink, leaf.age/vars.leaf_expansion)/100.0
246246
plot(0:1:50, x -> sink_strength(TreeTypes.Leaf(age = x), TreeTypes.treeparams()),
247247
xlabel = "Age", ylabel = "Sink strength", label = "Leaf")
248-
savefig("leaf_sink_strength.png") ## hide
249-
250-
#![](leaf_sink_strength.png)
251248

252249
sink_strength(int) = pdf(int.sink, int.age)
253250
plot!(0:1:50, x -> sink_strength(TreeTypes.Internode(age = x)), label = "Internode")
254-
savefig("internode_sink_strength.png") ## hide
255251
```
256252

257-
#![](internode_sink_strength.png)
258-
259253
Now we need a function that updates the biomass of the tree, allocates it to the
260254
different organs and updates the dimensions of said organs. For simplicity,
261255
we create the functions `leaves()` and `internodes()` that will apply the queries
@@ -363,13 +357,9 @@ orientation and RGR:
363357
```julia
364358
RGRs = rand(Normal(0.3,0.01), 10, 10)
365359
histogram(vec(RGRs))
366-
savefig("RGRs.png") ## hide
367-
#![](RGRs.png)
368360

369361
orientations = [rand()*360.0 for i = 1:2.0:20.0, j = 1:2.0:20.0]
370362
histogram(vec(orientations))
371-
savefig("orientations.png") ## hide
372-
#![](orientations.png)
373363

374364
origins = [Vec(i,j,0) for i = 1:2.0:20.0, j = 1:2.0:20.0];
375365
nothing #hide
@@ -419,12 +409,9 @@ end
419409
soil_graph = RA(-90.0) + T(Vec(0.0, 10.0, 0.0)) + ## Moves into position
420410
Soil(length = 20.0, width = 20.0) ## Draws the soil tile
421411
soil = Scene(Graph(axiom = soil_graph));
422-
pl = render(soil, axes = false)
423-
GLMakie.save("soil.png", pl) ## hide
412+
render(soil, axes = false)
424413
```
425414

426-
![](soil.png)
427-
428415
And the following function renders the entire scene (notice that we need to
429416
use `display()` to force the rendering of the scene when called within a loop
430417
or a function):
@@ -464,12 +451,9 @@ render_forest(forest, soil)
464451
for i in 1:50
465452
daily_step!(forest)
466453
end
467-
pl = render_forest(forest, soil)
468-
GLMakie.save("forest.png", pl) ## hide
454+
render_forest(forest, soil)
469455
```
470456

471-
![](forest.png)
472-
473457
And compute the leaf area index:
474458

475459
```julia

docs/src/tutorials/from_tree_forest/raytracedforest.md

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -391,19 +391,11 @@ sink_strength(leaf, vars) = leaf.age > vars.leaf_expansion ? 0.0 :
391391
pdf(leaf.sink, leaf.age/vars.leaf_expansion)/100.0
392392
plot(0:1:50, x -> sink_strength(TreeTypes.Leaf(age = x), TreeTypes.treeparams()),
393393
xlabel = "Age", ylabel = "Sink strength", label = "Leaf")
394-
savefig("leaf_sink_strength.png") ## hide
395-
```
396-
397-
![](leaf_sink_strength.png)
398394

399-
```julia
400395
sink_strength(int) = pdf(int.sink, int.age)
401396
plot!(0:1:50, x -> sink_strength(TreeTypes.Leaf(age = x)), label = "Internode")
402-
savefig("internode_sink_strength.png") ## hide
403397
```
404398

405-
![](internode_sink_strength.png)
406-
407399
Now we need a function that updates the biomass of the tree, allocates it to the
408400
different organs and updates the dimensions of said organs. For simplicity,
409401
we create the functions `leaves()` and `internodes()` that will apply the queries
@@ -514,12 +506,10 @@ orientation and RUE:
514506
```julia
515507
RUEs = rand(Normal(1.5,0.2), 10, 10)
516508
histogram(vec(RUEs))
517-
savefig("RUEs.png") ## hide
518-
#![](RUEs.png)
509+
519510
orientations = [rand()*360.0 for i = 1:2.0:20.0, j = 1:2.0:20.0]
520511
histogram(vec(orientations))
521-
savefig("orientations.png") ## hide
522-
#![](orientations.png)
512+
523513
origins = [Vec(i,j,0) for i = 1:2.0:20.0, j = 1:2.0:20.0];
524514
nothing #hide
525515
```
@@ -568,12 +558,9 @@ end
568558
soil_graph = RA(-90.0) + T(Vec(0.0, 10.0, 0.0)) + ## Moves into position
569559
Soil(length = 20.0, width = 20.0) ## Draws the soil tile
570560
soil = Scene(Graph(axiom = soil_graph));
571-
pl = render(soil, axes = false)
572-
GLMakie.save("soil.png", pl) ## hide
561+
render(soil, axes = false)
573562
```
574563

575-
![](soil.png)
576-
577564
And the following function renders the entire scene (notice that we need to
578565
use `display()` to force the rendering of the scene when called within a loop
579566
or a function):
@@ -598,17 +585,11 @@ for i in 1:20
598585
println("Day $i")
599586
daily_step!(forest, i + start)
600587
if mod(i, 5) == 0
601-
pl = render_forest(forest, soil)
602-
GLMakie.save("forest$i.png", pl) ## hide
588+
render_forest(forest, soil)
603589
end
604590
end
605591
```
606592

607-
![](forest5.png)
608-
![](forest10.png)
609-
![](forest15.png)
610-
![](forest20.png)
611-
612593
---
613594

614595
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*

0 commit comments

Comments
 (0)