Skip to content

Instantly share code, notes, and snippets.

@theogf
Created September 22, 2020 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theogf/9069bacc7038ad6fae37d622acd2a7ec to your computer and use it in GitHub Desktop.
Save theogf/9069bacc7038ad6fae37d622acd2a7ec to your computer and use it in GitHub Desktop.
Code for segfault when using observables
using Makie
using AbstractPlotting.MakieLayout
using OnlineStats
t = Node(0)
function foo()
scene, layout = layoutscene()
axis = layout[1,1] = LAxis(scene)
t = Node(0)
it = lift(t, init = MovingWindow(10, Float32)) do t
fit!(it[], Float32(t))
end
bar!(axis, t, it)
return scene, axis, t
end
function bar!(axis, t, it)
m = lift(t, init = Mean(Float32)) do t
fit!(m[], Float32(t))
end
v = lift(m, init = MovingWindow(10, Float32)) do m
fit!(v[], value(m))
end
p = lift(v, init = [Point2f0(0, 0)]) do v
Point2f0.(value(it[]), value(v))
end
scatter!(axis, p)
end
scene, axis, t = foo()
t[] = 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment