# Zoom in/out only works for first drawing on a figure

**URL:** https://discourse.julialang.org/t/zoom-in-out-only-works-for-first-drawing-on-a-figure/122752
**Category:** Visualization
**Tags:** makie, glmakie
**Created:** [November 17, 2024, 11:46pm UTC](https://discourse.julialang.org/t/zoom-in-out-only-works-for-first-drawing-on-a-figure/122752 "2024-11-17T23:46:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![AMB](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amb/32/211738_2.png) [@AMB](https://discourse.julialang.org/u/AMB)
#### Post date: [November 17, 2024, 11:46pm UTC](https://discourse.julialang.org/t/zoom-in-out-only-works-for-first-drawing-on-a-figure/122752/1 "2024-11-17T23:46:38Z")

</div>

Hi All. I’m wondering if somebody can explain the following behavior. I draw something, empty! the axis scene, and then draw something similar. All the drawing works as expected but I’ve noticed that while I can zoom in/out on the first drawing, I can’t for the second. Why is that?

```julia
using GLMakie
using GLMakie: Screen

fig = Figure()
screen = display(Screen(), fig)
ax = Axis(fig[1,1])

xs = range(0,2π, length = 100)
ys = sin.(xs)

lines!(ax, xs, ys; color=:green)
print("Try zooming in/out, then hit enter:") ; readline()

empty!(ax.scene)       

lines!(ax, xs, -ys; color=:red)
print("Try zooming in/out, then hit enter:") ; readline()

close(screen)

```

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [November 18, 2024, 2:57pm UTC](https://discourse.julialang.org/t/zoom-in-out-only-works-for-first-drawing-on-a-figure/122752/2 "2024-11-18T14:57:49Z")

</div>

Do `empty!(ax)` instead of `empty!(ax.scene)`, the latter kind of pulls the rug out from under the `Axis` by removing some connections needed for the interactions
