I have a visualization with sub-scenes. scene2
displays a polyline with text labels. Polylines change depending on mouse selections in scene1
. I would like to be able to clear scene2
in example below at commented line:
using Makie, Random, Formatting
scene = Scene(resolution = (1200, 1500))
scene1 = Scene(scene, IRect(0, 0, 1200, 900))
image = rand(1:4, 640, 480)
image!(scene1, image, scale_plot = false, show_axis = false, interpolate = false, colormap=[:white, :blue, :green, :red])
scene2 = Scene(scene, IRect(0, 900, 1200, 600))
poly = Vec2f.(1:10, rand(10))
lines!(scene2, poly)
for p in poly
text!(scene2, format("({:.3f}, {:.3f})", p[1], p[2]), position = p, textsize = 0.1, color = :red)
end
display(scene)
on(scene1.events.mousebuttons) do buttons
if ispressed(scene1, Mouse.left)
global scene2
poly = Vec2f.(1:10, rand(10))
# clear scene2 here
lines!(scene2, poly)
for p in poly
text!(scene2, format("({:.3f}, {:.3f})", p[1], p[2]), position = p, textsize = 0.1, color = :red)
end
end
end