You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/model_simulation/examples/interactive_brusselator_simulation.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,10 @@ Catalyst can utilize the [GLMakie.jl](https://github.com/JuliaPlots/GLMakie.jl)
7
7
8
8
Let's again use the oscillating Brusselator model, extending the basic simulation [plotting](@ref simulation_plotting) workflow we saw earlier.
9
9
10
-
```julia
10
+
```@example interactive_brusselator
11
11
using Catalyst
12
12
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.
14
14
15
15
# Define the Brusselator model
16
16
brusselator = @reaction_network begin
@@ -44,7 +44,7 @@ This code sets up our Brusselator model using Catalyst.jl's `@reaction_network`
44
44
45
45
Let's start by creating a basic plot of our Brusselator model:
46
46
47
-
```julia
47
+
```@example interactive_brusselator
48
48
# Create the main figure
49
49
fig = Figure(size = (800, 600), fontsize = 18);
50
50
@@ -68,9 +68,9 @@ axislegend(ax, position = :rt)
68
68
display(fig)
69
69
```
70
70
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:
The plot shows the concentrations of species X and Y over time. Notice the oscillatory behavior characteristic of the Brusselator model.
76
76
@@ -82,7 +82,7 @@ Now, let's add interactivity to our plot using Observables and sliders. We'll bu
82
82
83
83
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).
84
84
85
-
```julia
85
+
```@example interactive_brusselator
86
86
# Create observables for parameters and initial conditions
87
87
A = Observable(1.0)
88
88
B = Observable(4.0)
@@ -129,7 +129,7 @@ These sliders allow us to interactively change the parameters A and B, as well a
129
129
130
130
Now, let's create a plot that reacts to changes in our sliders:
131
131
132
-
```julia
132
+
```@example interactive_brusselator
133
133
# Create an axis for the plot
134
134
ax = Axis(plot_layout[1, 1],
135
135
title = "Brusselator Model",
@@ -151,18 +151,18 @@ axislegend(ax, position = :rt)
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.
160
160
161
161
## [Adding a phase plot](@id adding_phase_plot)
162
162
163
163
To gain more insight into the system's behavior, let's enhance our visualization by adding a phase plot, along with some other improvements:
0 commit comments