Makie - scene transformation not persisting

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:

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?

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

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

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

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?

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

Found a better way, this seems to works fine:

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

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