# Interactive Menu with AlgebraOfGraphics / GLMakie

**URL:** https://discourse.julialang.org/t/interactive-menu-with-algebraofgraphics-glmakie/93842
**Category:** Visualization
**Tags:** interactivity, algebraofgraphics
**Created:** [January 31, 2023, 10:47pm UTC](https://discourse.julialang.org/t/interactive-menu-with-algebraofgraphics-glmakie/93842 "2023-01-31T22:47:32Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![mreichMPI-BGC](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mreichmpi-bgc/32/43775_2.png) [@mreichMPI-BGC](https://discourse.julialang.org/u/mreichMPI-BGC)
#### Post date: [February 1, 2023, 9:24am UTC](https://discourse.julialang.org/t/interactive-menu-with-algebraofgraphics-glmakie/93842/2 "2023-02-01T09:24:32Z")

</div>

This comes closer, but now I don’t know how to delete the previous plot (and if I am roughly doing the right thing):

```julia
var=Observable("y1")
fig=Figure()
axentry = draw!(fig[1,1:1], data(df) * 
    mapping(:x1, Symbol(var[]), color=:x1) * 
    (visual(Scatter) + smooth(;span=0.3, degree=1)))
Colorbar(fig[:, 2])

menu = Menu(fig, options = ["y1","y2"] , default = "y1")
fig[2,1] = hgrid!(
        Label(fig, "Variable", width = nothing),
        menu,
        tellheight = true)
    
 on(menu.selection) do s
         var[] = s
         draw!(fig[1,1], data(df) * 
    mapping(:x1, Symbol(s), color=:x1) * 
    (visual(Scatter) + smooth(;span=0.3, degree=1)))
end

```

---

_[View the full topic](https://discourse.julialang.org/t/interactive-menu-with-algebraofgraphics-glmakie/93842)._
