A bit late to the party, but I am just starting to learn Julia and came across the Lorenz attractor example in the docs. While the approach is quite intuitive and elegant, I am struggling to extend this to subplots, i.e. two trajectories of the attractor next to each other.
I have tried to push to the subplots instead of the overall plot, but as far as I understand the error message, subplots do not support the pushing of new data?
N = 200
u1 = 20*rand(3, N)
u2 = 15*ones(3, N)
plt = plot3d(
1,
xlim = (-30, 30),
ylim = (-30, 30),
zlim = (0, 60),
title = ["Some trajectory" "Other trajectory"],
legend = false,
marker = 2,
layout = (1, 2)
)
@gif for i in range(1, size(u1, 2))
push!(plt[1], u1[:, i]...)
push!(plt[2], u2[:, i]...)
end every 10
Giving me the following error:
MethodError: no method matching push!(::Plots.Subplot{Plots.GRBackend}, ::Float64)
Closest candidates are:
push!(::Any, ::Any, !Matched::Any)
@ Base abstractarray.jl:3389
push!(::Any, ::Any, !Matched::Any, !Matched::Any...)
@ Base abstractarray.jl:3390
push!(!Matched::StatsBase.AbstractHistogram{T, 1}, ::Real) where T
@ StatsBase some_path\.julia\packages\StatsBase\WLz8A\src\hist.jl:294
...
Stacktrace:
[1] push!(A::Plots.Subplot{Plots.GRBackend}, a::Float64, b::Float64)
@ Base .\abstractarray.jl:3389
[2] push!(A::Plots.Subplot{Plots.GRBackend}, a::Float64, b::Float64, c::Float64)
@ Base .\abstractarray.jl:3390
[3] macro expansion
@ some_path\MMDS_Julia\ex2.ipynb:19 [inlined]
[4] top-level scope
@ some_path\.julia\packages\Plots\sxUvK\src\animation.jl:251
Any suggestion how to achieve the wanted effect?