How to update Makie.jl plot based on ComputeGraph?

juliohm
Wed, 15 Apr 2026 18:11:54 +0000
Visualization

I am using the ComputeGraph feature of Makie.jl for the first time. After adding widgets (observables) as nodes in the graph, I also added nodes for the plot objects:

# initialize scene with elements
# that do not depend on inputs
fig = Figure()
ax = Axis(fig[1,1])
sl = Slider(fig[1, 2], ...)

# create compute graph mapping
# inputs to outputs and plots
G = ComputeGraph()
add_input!(G, :w, sl.value)
map!(w -> [cos(w .* x) for x in 0:2pi], G, :w, :y)
map!(y -> lines!(ax, y), G, :y, :lineplot)

# initialize the elements in the
# scene that depend on inputs
G.lineplot[]

If I request the value of the node with the plot object, I get the display of the plot in the scene, as shown above. How to update these plot objects on every change to the mapped widgets? I am looking for the correct on idiom, something like:

on(any_change_to_input_nodes) do
  # update plots
  G.lineplot[]
  G.scatplot[]
  ...
end

1 post - 1 participant