I’m making an interactive heatmap where I get the mouse position and update a second plot. I provided a MWE where a horizontal line moves with the mouse, but I only want to update the line when the mouse is inside of this Axis. I see that pick()
might be the way to do this, but I can’t seem to figure out how. What should I be using?
using GLMakie
fig = Figure()
yline = Observable(50.0)
ax = Axis(fig[1, 1])
hm = heatmap!(rand(100, 100))
hlines!(yline, color = :red)
on(events(ax).mouseposition) do mpos
yline[] = trunc(Int, mouseposition(ax.scene)[2])
yaxis_limits = ax.yaxis.attributes.limits[]
if yline[] >= yaxis_limits[1] && yline[] <= yaxis_limits[2]
println("In bounds")
else
println("Out of bounds")
end
end
fig