I want to use GLMakie
for 3D plotting, but when I try to do the plotting I get a static image not in a Makie window:
https://i.imgur.com/R44xxJa.png
Earlier this morning it was working just fine, but I have since then upgraded to version 1.9. Why does the plotting seem to not use the GLMakie backend?
MWE
using GLMakie, DifferentialEquations, LinearAlgebra, SparseArrays
GLMakie.activate!()
N₁=31 # Number of waveguides / size of solution vector
γ=1 # Nonlinear term strength parameter
h=1 # Grid spacing
centerGrid = (N₁-1)/2;
x = -centerGrid:centerGrid;
# Coefficient matrix of second-order centered-difference operator (δ²u)ₙ
M = spdiagm(-1 => fill(1,N₁-1), 0 => fill(-2,N₁), 1 => fill(1,N₁-1))
M[N₁,1] = 1; # Periodic boundary conditions
M[1,N₁] = 1;
# RHS of DNLS. The solution vector u is a N₁x1 complex vector
g₁(u,p,t) = 1*im*(-1*M*u - @.(γ*((abs(u))^2).*u) )
# Julia is explicitly typed (e.g, cannot have Ixnt and Complex in same array) and so we must convert the object containing the initial data to be complex
u0 = Complex.(sech.(x))
tspan = (0.0,200)
prob = ODEProblem(g₁,u0,tspan, [h])
sol = solve(prob, Tsit5(), reltol=1e-8, abstol=1e-8)
z= [abs(sol.u[i][j])^2 for j=1:N₁, i=1:size(sol)[2]] # |u|²
y = sol.t
fig = Figure()
p1 = surface(fig[1,1], x, y, z,axis=(type=Axis3, xlabel="Space", ylabel="Time", zlabel="|u|²"))
#xticks!(fig, -N₁:1:N₁)
p2 = contourf(fig[1,2], x, y, z, axis=(xlabel="Space", ylabel="Time"))
fig
#save("dnls_makie.png", fig)
#plt = plot(p1,p2,layout=(1,2), size=(1200,800))
julia> Makie.current_backend()
GLMakie