简体   繁体   English

牧江animation中的slider position怎么改?

[英]How to change slider position in Makie animation?

I want to create gif animation on my topoplot and I almost succeeded.我想在我的 topoplot 上创建 gif animation,我几乎成功了。 The only problem is that slider position does not move.唯一的问题是 slider position 不动。 How to make it moving?如何让它动起来?

看 - 滑块位置不变

Here is my code:这是我的代码:

xs = range(-0.3, length=size(dat_e, 2), step=1 ./ 128) 
sg = SliderGrid(f[2, 1],
    (label="time", range=xs, format = "{:.3f} ms", startvalue = 0),
)
time = sg.sliders[1].value
str = lift(t -> "[$(round(t, digits = 3)) ms]", time)
topo_slice = lift((t, data) -> mean(data[1:30, indexin(t, xs), :], dims=2)[:,1], time, dat_e)
topo_axis = Axis(f[1, 1], aspect = DataAspect(), title = "Interactive topoplot")
topo = eeg_topoplot!(topo_axis, topo_slice, # averaging all trial of 30 participants on Xth msec
    raw.ch_names[1:30]; 
    positions=pos, # produced  automatically from ch_names
    #interpolation=DelaunayMesh(),
    enlarge=1,
    extrapolation=GeomExtrapolation(enlarge=1.0, geometry=Circle),
    label_text=true) # aspect ratio, correlation of height and width

text!(topo_axis, 1, 1, text = str,  align = (:center, :center))
xlims!(-0.2, 1.2)
ylims!(-0.2, 1.2)
hidedecorations!(topo_axis)
hidespines!(topo_axis) 

framerate = 1
timestamps = [-0.3, 0.0828125, 0.1609375, 0.2390625]

record(f, "animations/time_animation.gif", timestamps;
        framerate = framerate) do z
    sg.sliders[1].value[] = z
    time[] = z

Maybe this will do the trick:也许这会成功:

Makie.set_close_to!(sg.sliders[1], z)

(use this to set the value to z ) (使用它来将值设置为z

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM