Skip to content

Commit 626da00

Browse files
Simplify DiffEqArray recipe: always use diffeq_to_arrays path
Remove the fast-path branch in the AbstractDiffEqArray recipe that bypassed diffeq_to_arrays when no interp was available. Now all cases go through the same code path, ensuring denseplot=true/false is always respected: - denseplot=true: generates plotdensity interpolated points via callable - denseplot=false: uses raw saved time points from A.t Also clean up SciMLBase that leaked into [deps] from Pkg.develop. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 69798c3 commit 626da00

File tree

1 file changed

+34
-46
lines changed

1 file changed

+34
-46
lines changed

src/vector_of_array.jl

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,63 +1368,51 @@ end
13681368
tspan = nothing, plotat = nothing,
13691369
idxs = nothing)
13701370

1371-
# If the array has no callable interp and it's a simple case, use the fast path
1372-
has_interp = hasproperty(VA, :interp) && VA.interp !== nothing
1373-
if !has_interp && idxs === nothing && plotat === nothing
1374-
# Simple fast path: just plot t vs u
1375-
indepsyms = independent_variable_symbols(VA)
1376-
xguide --> (isempty(indepsyms) ? "" : string(indepsyms[1]))
1377-
varsyms = variable_symbols(VA)
1378-
label --> (isempty(varsyms) ? "" : reshape(string.(varsyms), 1, :))
1379-
VA.t, VA'
1371+
idxs_input = idxs === nothing ? plottable_indices(VA.u[1]) : idxs
1372+
if !(idxs_input isa Union{Tuple, AbstractArray})
1373+
vars = interpret_vars([idxs_input], VA)
13801374
else
1381-
# Full-featured path: interpret vars, handle phase plots, use callable
1382-
idxs_input = idxs === nothing ? plottable_indices(VA.u[1]) : idxs
1383-
if !(idxs_input isa Union{Tuple, AbstractArray})
1384-
vars = interpret_vars([idxs_input], VA)
1385-
else
1386-
vars = interpret_vars(idxs_input, VA)
1387-
end
1375+
vars = interpret_vars(idxs_input, VA)
1376+
end
13881377

1389-
tdir = sign(VA.t[end] - VA.t[1])
1390-
xflip --> tdir < 0
1391-
seriestype --> :path
1378+
tdir = sign(VA.t[end] - VA.t[1])
1379+
xflip --> tdir < 0
1380+
seriestype --> :path
13921381

1393-
tscale = get(plotattributes, :xscale, :identity)
1394-
plot_vecs, labels = diffeq_to_arrays(
1395-
VA, denseplot, plotdensity, tspan, vars, tscale, plotat
1396-
)
1382+
tscale = get(plotattributes, :xscale, :identity)
1383+
plot_vecs, labels = diffeq_to_arrays(
1384+
VA, denseplot, plotdensity, tspan, vars, tscale, plotat
1385+
)
13971386

1398-
# Axis labels for tuple-style idxs
1399-
if idxs_input isa Tuple && vars[1][1] === DEFAULT_PLOT_FUNC
1400-
for (guide, idx) in [(:xguide, 2), (:yguide, 3)]
1401-
if idx <= length(vars[1])
1402-
guide --> _var_label(VA, vars[1][idx])
1403-
end
1404-
end
1405-
if length(vars[1]) > 3
1406-
zguide --> _var_label(VA, vars[1][4])
1387+
# Axis labels for tuple-style idxs
1388+
if idxs_input isa Tuple && vars[1][1] === DEFAULT_PLOT_FUNC
1389+
for (guide, idx) in [(:xguide, 2), (:yguide, 3)]
1390+
if idx <= length(vars[1])
1391+
guide --> _var_label(VA, vars[1][idx])
14071392
end
14081393
end
1394+
if length(vars[1]) > 3
1395+
zguide --> _var_label(VA, vars[1][4])
1396+
end
1397+
end
14091398

1410-
# Default xguide for time-vs-variable plots
1411-
if all(x -> (x[2] isa Integer && x[2] == 0) ||
1412-
isequal(x[2], getindepsym_defaultt(VA)), vars)
1413-
xguide --> "$(getindepsym_defaultt(VA))"
1414-
if tspan === nothing
1415-
if tdir > 0
1416-
xlims --> (VA.t[1], VA.t[end])
1417-
else
1418-
xlims --> (VA.t[end], VA.t[1])
1419-
end
1399+
# Default xguide for time-vs-variable plots
1400+
if all(x -> (x[2] isa Integer && x[2] == 0) ||
1401+
isequal(x[2], getindepsym_defaultt(VA)), vars)
1402+
xguide --> "$(getindepsym_defaultt(VA))"
1403+
if tspan === nothing
1404+
if tdir > 0
1405+
xlims --> (VA.t[1], VA.t[end])
14201406
else
1421-
xlims --> (tspan[1], tspan[end])
1407+
xlims --> (VA.t[end], VA.t[1])
14221408
end
1409+
else
1410+
xlims --> (tspan[1], tspan[end])
14231411
end
1424-
1425-
label --> reshape(labels, 1, length(labels))
1426-
(plot_vecs...,)
14271412
end
1413+
1414+
label --> reshape(labels, 1, length(labels))
1415+
(plot_vecs...,)
14281416
end
14291417
@recipe function f(VA::DiffEqArray{T, 1}) where {T}
14301418
VA.t, VA.u

0 commit comments

Comments
 (0)