Skip to content

Commit 1fc79df

Browse files
changed code blocks to run dynamically
1 parent df78148 commit 1fc79df

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/src/model_simulation/examples/interactive_brusselator_simulation.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Catalyst can utilize the [GLMakie.jl](https://github.com/JuliaPlots/GLMakie.jl)
77

88
Let's again use the oscillating Brusselator model, extending the basic simulation [plotting](@ref simulation_plotting) workflow we saw earlier.
99

10-
```julia
10+
```@example interactive_brusselator
1111
using Catalyst
1212
using OrdinaryDiffEq
13-
using GLMakie
13+
using GLMakie; GLMakie.activate!(inline = true) # Activate the GLMakie backend. Here we set `inline = true` so that the plot is displayed inline for this documentation, but you can leave it out in your own work if you prefer plots displayed in a separate window.
1414
1515
# Define the Brusselator model
1616
brusselator = @reaction_network begin
@@ -44,7 +44,7 @@ This code sets up our Brusselator model using Catalyst.jl's `@reaction_network`
4444

4545
Let's start by creating a basic plot of our Brusselator model:
4646

47-
```julia
47+
```@example interactive_brusselator
4848
# Create the main figure
4949
fig = Figure(size = (800, 600), fontsize = 18);
5050
@@ -68,9 +68,9 @@ axislegend(ax, position = :rt)
6868
display(fig)
6969
```
7070

71-
This will produce a basic time series plot of the Brusselator model:
71+
<!-- This will produce a basic time series plot of the Brusselator model:
7272
73-
![Basic Brusselator Plot](../../assets/brusselator_basic_plot.svg)
73+
![Basic Brusselator Plot](../../assets/brusselator_basic_plot.svg) -->
7474

7575
The plot shows the concentrations of species X and Y over time. Notice the oscillatory behavior characteristic of the Brusselator model.
7676

@@ -82,7 +82,7 @@ Now, let's add interactivity to our plot using Observables and sliders. We'll bu
8282

8383
Observables are a key concept in reactive programming and are central to how Makie.jl creates interactive visualizations. You can read more about them [here](https://docs.makie.org/stable/explanations/observables).
8484

85-
```julia
85+
```@example interactive_brusselator
8686
# Create observables for parameters and initial conditions
8787
A = Observable(1.0)
8888
B = Observable(4.0)
@@ -129,7 +129,7 @@ These sliders allow us to interactively change the parameters A and B, as well a
129129

130130
Now, let's create a plot that reacts to changes in our sliders:
131131

132-
```julia
132+
```@example interactive_brusselator
133133
# Create an axis for the plot
134134
ax = Axis(plot_layout[1, 1],
135135
title = "Brusselator Model",
@@ -151,18 +151,18 @@ axislegend(ax, position = :rt)
151151
# Display the figure
152152
display(fig)
153153
```
154-
154+
<!--
155155
The resulting figure should look like this:
156156
157-
![Interactive Brusselator Plot](../../assets/brusselator_interactive_plot.svg)
157+
![Interactive Brusselator Plot](../../assets/brusselator_interactive_plot.svg) -->
158158

159159
This plot will now update in real-time as you move the sliders, allowing for interactive exploration of the Brusselator's behavior under different conditions.
160160

161161
## [Adding a phase plot](@id adding_phase_plot)
162162

163163
To gain more insight into the system's behavior, let's enhance our visualization by adding a phase plot, along with some other improvements:
164164

165-
```julia
165+
```@example interactive_brusselator
166166
# Create the main figure
167167
fig = Figure(size = (1200, 800), fontsize = 18);
168168

0 commit comments

Comments
 (0)