Recently a new Makie recipe for DifferentialEquations was added using PlotSpec
. However, I noticed that at least two things are not working:
- Line attributes are ignored. For example,
linestyle
andlinewidth
are always set to default values:
using OrdinaryDiffEq # v6.70.1
using GLMakie # v0.9.8
function lorenz(du,u,p,t)
du[1] = p[1]*(u[2]-u[1])
du[2] = u[1]*(p[2]-u[3]) - u[2]
du[3] = u[1]*u[2] - p[3]*u[3]
end
u0 = [1., 5., 10.]
tspan = (0., 100.)
p = (10.0,28.0,8/3)
prob = ODEProblem(lorenz, u0, tspan,p)
sol = solve(prob, Tsit5())
f, ax, pl = lines(sol, linestyle=:dot) # linestyle is always :solid!
When I tried to modify the attributes for the 1st issue
ax.scene.plots[1].linestyle = :dash
it returned an error ERROR: cannot convert a value to nothing for assignment
.
- Plot transformation (e.g. scale!) has no effect
using OrdinaryDiffEq
using GLMakie
function lorenz(du,u,p,t)
du[1] = p[1]*(u[2]-u[1])
du[2] = u[1]*(p[2]-u[3]) - u[2]
du[3] = u[1]*u[2] - p[3]*u[3]
end
u0 = [1., 5., 10.]
tspan = (0., 100.)
p = (10.0,28.0,8/3)
prob = ODEProblem(lorenz, u0, tspan,p)
sol = solve(prob, Tsit5())
f, ax, pl = plot(sol)
axislegend(ax)
# This is not working! Should become 0 - 1000 for the x axis but still keep the original 0-100
scale!(pl, 10, 1)
f
We may for now choose to scale each child plot individually like
scale!(ax.scene.plots[1], 10, 1) # scale x-axis by 10
Before the official fix to these reported issues, how can we currently work around them?