I’m relatively new to Julia and I’m trying to design a logistics application with GLMakie. Depending on some interactions I want to change the colors and markers on a map. I used Observables but it doesn’t work… What am I doing wrong??
using GLMakie
fig = Figure(backgroundcolor = :lightgrey)
ax = Axis(fig[1, 1] )
limits!(ax, 0, 10, 0, 10)
loc_color = Observable(:black)
loc_mark = Observable(:circle)
p1 = scatter!(ax, 5, 8, color = loc_color, marker=loc_mark, markersize = 20)
b1 = false
but1 = Button(fig[1,2], tellheight = false)
on(but1.clicks) do n
if (b1)
loc_color[] = :red
loc_mark[] = :circle
else
loc_color[] = :green
loc_mark[] = :utriangle
end
b1 = !b1
end
fig
Thanks, sdanisch,
I was surprised that I didn’t do that but something went wrong in my copy. It was in my code. I removed the notify’s but still it is not working…
I changed the code above as it is in my VScode.
Yet, it works now!
But:… it don’t get it fully why I need the ‘global’ definitions: does that have to do with the scope of the on…end code block?
Thanks!