# Zoom, translate, rotate and save

**URL:** <https://discourse.julialang.org/t/zoom-translate-rotate-and-save/134526>\
**Category:** Visualization\
**Tags:** plotting, glmakie\
**Created:** [December 12, 2025, 11:18pm UTC](https://discourse.julialang.org/t/zoom-translate-rotate-and-save/134526 "2025-12-12T23:18:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [December 12, 2025, 11:18pm UTC](https://discourse.julialang.org/t/zoom-translate-rotate-and-save/134526/1 "2025-12-12T23:18:24Z")

</div>

I also want to create many 3D plots. I will zoom and rotate each to same extent and then save them. How to do it?  
How to translate and rotate by code?  
What is range of value that we can supply in `zoom!()` line end?

```julia-auto
using GLMakie
fig = Figure()
ax = LScene(fig[1,1], show_axis=false)
box = Rect3f(Vec3f(-1, -2, -0.5), Vec3f(2, 4, 1))
mesh!(ax, box, color = :steelblue)
zoom!(ax.scene, cameracontrols(ax.scene), 2)
update_cam!(ax.scene, cameracontrols(ax.scene))
display(fig, update=false)

```

---

<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:** [December 13, 2025, 12:11pm UTC](https://discourse.julialang.org/t/zoom-translate-rotate-and-save/134526/2 "2025-12-13T12:11:38Z")

</div>

You can use `translate_cam!` and `rotate_cam!` but in my opinion `update_cam!(scene, camcontrols, eyeposition, lookat, upvector)` and the angle version are easier to use. `eyeposition` is where the camera is, `lookat` is the point it looks at and `upvector` is the up direction of your screen.

> [@raman\_kumar](#):
>
> What is range of value that we can supply in `zoom!()` line end?

Iirc `0 < zoom_mult < Inf`

---

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [December 13, 2025, 12:18pm UTC](https://discourse.julialang.org/t/zoom-translate-rotate-and-save/134526/3 "2025-12-13T12:18:07Z")

</div>

> [@ffreyer](#):
>
> update\_cam!(scene, camcontrols, eyeposition, lookat, upvector)

Please can you explain it in detail as i could not find examples in the [3D-Camera](https://docs.makie.org/dev/explanations/cameras#3D-Camera) documentation.

---

<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:** [December 13, 2025, 2:38pm UTC](https://discourse.julialang.org/t/zoom-translate-rotate-and-save/134526/4 "2025-12-13T14:38:10Z")

</div>

I’m not sure what else there is to explain. Those variables are enough to uniquely define the camera orientation and position and the function applies them. To get an intuition for what the variables do, you can set up a demo scene and just try some different values

```julia-auto
fig = Figure()
ax = LScene(fig[1,1], show_axis=false)
mesh!(ax, Rect3f(-0.2, -0.2, -0.2, 0.4, 0.4, 0.4), color = :gray)
mesh!(ax, Rect3f(0.5, -0.2, -0.2, 0.4, 0.4, 0.4), color = :red)
mesh!(ax, Rect3f(-0.2, 0.5, -0.2, 0.4, 0.4, 0.4), color = :green)
mesh!(ax, Rect3f(-0.2, -0.2, 0.5, 0.4, 0.4, 0.4), color = :blue)
update_cam!(
    ax.scene, cameracontrols(ax), 
    Point3f(2, 0.5, 1), Point3f(0, 0, 0.5), Vec3f(0, 0, 1)
)
display(fig, update=false)

```

Probably also useful to note that the camera tracks these values. If you interactively move and rotate the camera to an orientation you want, you can read out `cameracontrols(ax).eyeposition[]` etc. and restore the orientation by calling `update_cam!` with the same values.
