Makie - 3d plot with positive Z axis pointing down?

I am trying to visualize an aircraft trajectory. We define the local z vector as down.

I see how to do this in the 2d axis but no options to invert the Z axis in Axis3.

Basically, I am hoping to have the Z-axis positive down and the x and y axis do not matter as long as they conform to a right-handed coordinate system. I also assume I can still easily adjust x and y orientation using the elevation and azimuth commands.

For reference, here is the data plotting as is. The aircraft is physically diving downwards (in a positive z direction) starting from level flight in the origin.

Any help would be greatly appreciated.

2 Likes

I think I have not implemented axis flips for Axis3, yet. In principle it’s not difficult, it’s mostly a sign flip in some projection matrix. Maybe file an issue so we can keep track of it? If you’re willing to take a stab at it yourself I could try to help you as well if you get stuck

You could modify the zticks while displaying the points with inverted z-coordinates, like that for example

(x,y,z) = (rand(5),rand(5),rand(5))

(zmin, zmax, zstep) = (0.0, 1.0, 0.5)

f = Figure()
ax = Axis3(f[1,1],
    zticks = (collect(-zmax:zstep:zmin), map(x->"$x",collect(zmax:-zstep:zmin)))
    )

lines!(ax,x,y,-z)

xlims!(ax,(0.0,1.0))
ylims!(ax,(0.0,1.0))
zlims!(ax,(-zmax,zmin))
f

Ah, okay, thanks! I will open an issue and see if I can figure it out, cheers.

I think this could work for a short workaround, I’ll be needing to do a lot of plotting, and it is critical that the plots stay properly in the coordinate systems, so I cannot afford to only flip one axis. Thanks for the work around though!

1 Like

I guess you could define a specific recipe to easily make a lot of plots, though I have never done that

I have made an issue and tried to make it somewhat informative.

I started digging and think I’m pretty far out of my depth on creating pull request to implement the feature myself. I am pretty new to Julia and not sure where I would start to implement such a feature. Any tips?

Here is the issue: zreversed feature in Axis3 · Issue #3137 · MakieOrg/Makie.jl · GitHub