# Plotting in phase space with Makie.jl

I have an `10-element Vector{Array{Float64, 6}}:` that gives the solution to a 6D + time PDE at every point in phase space on a certain interval as it progress through 10 time steps (hence the 10-element vector).

I want to plot this as two three-dimensional volume plots (3D for velocity space + 3D for space) animated through time. Is there any way to do this with Makie.jl?

I am setting up my input data (in the context of a larger program) like so

``````ts, xs, ys, zs, vxs, vys, vzs = [0:0.1:1 for d in domains] # 7-element Vector{StepRangeLen...
u = [collect(sol.u([t,x,y,z,vx,vy,vz]) for x in xs, y in ys, z in zs, vx in vxs, vy in vys, vz in vzs) for t in ts] # 11-element Vector{Array{Float64, 6}}
``````

But you can test a similar data structure with `sol = [rand(10,10,10,10,10,t) for t in 1:10]`

I’m not sure if I misunderstand your data and if this solution is plain wrong, but have a look:

``````using GLMakie
GLMakie.activate!()

ts = 1:10
data = [rand(10,10,10,10,10,10) for t in ts]

i = Observable(1)

f = Figure()

data_1 = @lift(data[\$i][:, :, :, 1, 1, 1])
data_2 = @lift(data[\$i][1, 1, 1, :, :, :])

volume(f[1, 1], data_1, axis = (;type = Axis3))
volume(f[1, 2], data_2, axis = (;type = Axis3))

ls = labelslider!(f, "t", ts)
f[2, 1:2] = ls.layout
connect!(i, ls.slider.value)

f
`````` 2 Likes

I believe that since this is for points, instead of `volume` is a `meshscatter` for all `Point3f` s. Other than that, looks awesome.

@lazarusA
How do you mean that? changing `volume(f[1, 1], data_1, axis = (;type = Axis3))` with `meshscatter(f[1, 1], data_1, axis = (;type = Axis3))` would be more accurate?