I have an interactive topoplot: clicking on a channel marker shows its name. I want to record it so that I can see how I press a marker with the cursor and its name changes. Do you know how to do this?
I tried, but the animation remains frozen.
let
f = Figure(backgroundcolor = RGBf(0.98, 0.98, 0.98))
data, pos = TopoPlots.example_data()
N = 1:length(pos)
positions = Observable(rand(Point2f, 10))
topo_axis = Axis(f[1, 1], aspect = DataAspect())
xlims!(low = -0.2, high = 1.2)
ylims!(low = -0.2, high = 1.2)
cmap = collect(ColorScheme(range(colorant"black", colorant"black", length=2)))
mark_size = repeat([21], 64)
mark_color = repeat([1], 64)
labels = ["s$i" for i in 1:size(data, 1)]
topo = eeg_topoplot!(topo_axis, data[:, 340, 1], labels;
mark_color,
N,
positions=pos,
interpolation=NullInterpolator(),
enlarge=1,
colormap = cmap,
markersize = mark_size,
label_text=false
)
hidedecorations!(current_axis())
hidespines!(current_axis())
i = Observable(1)
str = lift((i, labels) -> "$(labels[i])", i, labels)
text!(topo_axis, 1, 1, text = str, align = (:center, :center))
on(events(f).mousebutton, priority = 2) do event
if event.button == Mouse.left && event.action == Mouse.press
plt, p = pick(topo_axis)
i[] = p
end
end
record(f, "test.mp4"; framerate = 10) do io
for i = 1:100
sleep(1/fps)
recordframe!(io)
end
end
f
end