# Adding a plot triggers axis reset in Makie

**URL:** <https://discourse.julialang.org/t/adding-a-plot-triggers-axis-reset-in-makie/114820>\
**Category:** Visualization\
**Tags:** question, makie\
**Created:** [May 28, 2024, 9:00am UTC](https://discourse.julialang.org/t/adding-a-plot-triggers-axis-reset-in-makie/114820 "2024-05-28T09:00:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [May 28, 2024, 9:00am UTC](https://discourse.julialang.org/t/adding-a-plot-triggers-axis-reset-in-makie/114820/1 "2024-05-28T09:00:28Z")

</div>

If I have a makie plot

```julia
using GLMakie
fig = Figure()
ax = Axis(fig[1,1])
scatter!(ax, 10, 10)
fig

```

zoom and pan and then add another plot

```julia
scatter!(ax, 0, 0)

```

the view port is reset.

How can I prevent that?

---

<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:** [May 28, 2024, 9:30am UTC](https://discourse.julialang.org/t/adding-a-plot-triggers-axis-reset-in-makie/114820/2 "2024-05-28T09:30:14Z")

</div>

the limits you get by zooming and panning are different limits than the ones you set explicitly with `limits!` or so, the interaction ones are overwritten by a new plot as the assumption is that you’d want to see what you’re adding. You can overwrite the explicit limits with the current limits I think, maybe with `limits!(ax, ax.finallimits[])` and then the new plot shouldn’t touch those

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [May 28, 2024, 11:01am UTC](https://discourse.julialang.org/t/adding-a-plot-triggers-axis-reset-in-makie/114820/3 "2024-05-28T11:01:08Z")

</div>

Thanks for the hint. This worked for me:

```julia
limits = ax.finallimits[]
scatter!(ax, 0, 0)
limits!(ax, limits)

```
