I am trying to make a simple plot updating on a keypress.
I get the “step” to update when I press the keys, but the plot stays the same. I can’t seem to find any examples of such a case.
It is probably something simple, but I can’t figure it out. Can anyone point me in the right direction?
using GLMakie
fig = Figure(resolution = (1920,1080));
ax = fig[1,1] = Axis(fig);
r = rand(200);
step = Node(1:100)
function step_back()
global step.val = 10:110
end
function step_forw()
global step.val = 5:105
end
on(events(fig).keyboardbutton) do event
if event.action in (Keyboard.press, Keyboard.repeat)
event.key == Keyboard.left && step_back()
event.key == Keyboard.right && step_forw()
end
# Let the event reach other listeners
return Consume(true)
end
lines!(@lift(r[$step,1]));
display(fig);