# Keyboard shortcut to reset zoom and pan on a Makie plot

**URL:** <https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [February 22, 2022, 12:59am UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876 "2022-02-22T00:59:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [February 22, 2022, 12:59am UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/1 "2022-02-22T00:59:02Z")

</div>

Is there a keyboard shortcut to reset the zoom and pan on a Makie plot?

---

<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:** [February 22, 2022, 6:01am UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/2 "2022-02-22T06:01:32Z")

</div>

Ctrl and click

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [May 25, 2022, 5:46pm UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/3 "2022-05-25T17:46:00Z")

</div>

Thanks! Unfortunately, it doesn’t seem to work for 3D plots. Is there a different keyboard shortcut for 3D plots?

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [January 31, 2024, 1:31am UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/4 "2024-01-31T01:31:09Z")

</div>

`center!(ax.scene)` resets the zoom and pan on a Camera3D LScene. if you want to bind it to key you need to catch an event.

is there a similar method to reset the rotation?

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [January 31, 2024, 2:52pm UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/5 "2024-01-31T14:52:33Z")

</div>

except, that there seems to be a bug in `center!`, in that if you’ve repositioned the camera to focus on a plot object using left\_alt mouse\_left, then it doesn’t work.

---

<div class="post-metadata">

**Author:** ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)\
**Post date:** [January 31, 2024, 4:08pm UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/6 "2024-01-31T16:08:35Z")

</div>

We have some code in there that is supposed to stop the camera from re-centering when adding plots after calling `update_cam!(scene, eyepos, lookat)` iirc. That’s also triggering on left alt + mouse click though, which it probably shouldn’t.

You can reset that by setting `cameracontrols(a).settings.center[] = true`. After that `center!` should work again. There should also be a left shift + click interaction for centering but that’s currently broken for some reason.

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [February 1, 2024, 1:53pm UTC](https://discourse.julialang.org/t/keyboard-shortcut-to-reset-zoom-and-pan-on-a-makie-plot/76876/7 "2024-02-01T13:53:59Z")

</div>

> [@ffreyer](#):
>
> cameracontrols(a).settings.center = true

thanks! that works, barring two peculiarties: 1. i have to click twice to recenter, and 2. it resets the lookat too.

should i file an issue? i ask, because between Axis3, LScene, and OldAxis i have no idea what is planned to be supported going forward and what will be deprecated.
