# Makie - scene transformation not persisting

**URL:** https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157
**Category:** Visualization
**Tags:** makie, glmakie
**Created:** [October 10, 2024, 3:47pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157 "2024-10-10T15:47:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [October 10, 2024, 3:47pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/1 "2024-10-10T15:47:29Z")

</div>

I’ve been trying to use `transformation` so I can change one property of an `Axis3` without rotating all the content individually.

I have this function:

```julia
function rotate_axis(ax::Axis3)
    ax.scene.transformation.rotation[] = Quaternion(cos(pi/4),0,sin(pi/4),0)
    # ax.limits[] = ax.limits[][[5,6,3,4,1,2]]
    nothing
end

```

I have to comment out the limits change, otherwise the transformation is reset. If I resize the GLMakie window, the transformation is reset. Is there a better way to set this transformation such that it doesn’t reset?

---

<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: [October 10, 2024, 4:01pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/2 "2024-10-10T16:01:33Z")

</div>

You want to rotate everything in an Axis3 without rotating the axis itself?

---

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [October 10, 2024, 4:10pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/3 "2024-10-10T16:10:04Z")

</div>

Rotating the entire axis would also work - I didn’t realise that would be possible. I just went searching through the attributes of `ax` and `ax.scene` and found `ax.scene.transformation`

Rotating the contents and changing the limits was just my approach:

![image](https://global.discourse-cdn.com/julialang/original/3X/d/2/d26c7648dd6277fe0c572f51468e138bbc9c4cb6.png)

I realised I can switch the limits first and then do the transformation so the transformation sticks, but if I resize the GLMakie window the transformation is lost:

![image](https://global.discourse-cdn.com/julialang/original/3X/b/4/b492ed543c74485462757ef6c23f960d0e2612aa.png)

---

<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: [October 10, 2024, 4:16pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/4 "2024-10-10T16:16:56Z")

</div>

Oh you don’t mean rotation in the sense of ax.azimuth and ax.elevation but that your data is not oriented with the z-coordinate upwards?

---

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [October 10, 2024, 4:22pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/5 "2024-10-10T16:22:23Z")

</div>

Ah sorry, yeah that’s what I mean. Everything is generally oriented with the z axis in my code. For visualisation purposes I’d like to show things aligned with x axis

---

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [October 10, 2024, 5:54pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/6 "2024-10-10T17:54:48Z")

</div>

Found a better way, this seems to works fine:

```julia
for plot in ax.scene.plots
    GLMakie.rotate!(plot,Quaternion(cos(pi/4),0,sin(pi/4),0))
end

```

---

<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: [October 10, 2024, 7:12pm UTC](https://discourse.julialang.org/t/makie-scene-transformation-not-persisting/121157/7 "2024-10-10T19:12:22Z")

</div>

Maybe it could also be useful to give `Axis3` an attribute by which the directions of the three axes can be chosen. Something like `:xyz`, `:xzy`, `:zxy` or so
