Skip to content

Commit 71ee6b1

Browse files
fix plots
1 parent 6db8466 commit 71ee6b1

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/integrator_interface.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ intervals(integrator::DEIntegrator) = IntegratorIntervals(integrator)
9595
for x in vars
9696
for j in 1:dims
9797
if denseplot
98-
push!(plot_vecs[j], u_n(plot_timeseries, x[j],integrator.sol,plott,plot_timeseries,0))
98+
push!(plot_vecs[j], u_n(plot_timeseries, x[j],integrator.sol,plott,plot_timeseries))
9999
else # just get values
100100
if x[j] == 0
101101
push!(plot_vecs[j], integrator.t)
@@ -113,7 +113,7 @@ intervals(integrator::DEIntegrator) = IntegratorIntervals(integrator)
113113
for x in vars
114114
for j in 1:dims
115115
if denseplot
116-
push!(plot_vecs[j], u_n(plot_timeseries, x[j],sol,plott,plot_timeseries,0))
116+
push!(plot_vecs[j], u_n(plot_timeseries, x[j],sol,plott,plot_timeseries))
117117
else # Just get values
118118
if x[j] == 0
119119
push!(plot_vecs[j], integrator.t)

src/solutions/solution_interface.jl

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ end
7575
end
7676
else
7777
# Plot for sparse output: use the timeseries itself
78-
if end_idx == 0
78+
if sol.tslocation == 0
7979
plott = sol.t
8080
plot_timeseries = sol.u
8181
if plot_analytic
@@ -95,7 +95,7 @@ end
9595
@assert length(var) == dims
9696
end
9797
# Should check that all have the same dims!
98-
plot_vecs,labels = solplot_vecs_and_labels(dims,int_vars,plot_timeseries,plott,sol,plot_analytic,end_idx)
98+
plot_vecs,labels = solplot_vecs_and_labels(dims,int_vars,plot_timeseries,plott,sol,plot_analytic)
9999

100100
tdir = sign(sol.t[end]-sol.t[1])
101101
xflip --> tdir < 0
@@ -237,20 +237,12 @@ function add_analytic_labels!(labels,x,dims,sol)
237237
end
238238
end
239239

240-
function u_n(timeseries::AbstractArray, n::Int,sol,plott,plot_timeseries,end_idx)
240+
function u_n(timeseries::AbstractArray, n::Int,sol,plott,plot_timeseries)
241241
# Returns the nth variable from the timeseries, t if n == 0
242242
if n == 0
243-
if end_idx == 0
244-
return plott
245-
else
246-
return plott[1:end_idx]
247-
end
243+
return plott
248244
elseif n == 1 && !(typeof(sol[1]) <: AbstractArray)
249-
if end_idx == 0
250-
return timeseries
251-
else
252-
return timeseries[1:end_idx]
253-
end
245+
return timeseries
254246
else
255247
tmp = Vector{eltype(sol[1])}(length(plot_timeseries))
256248
for j in 1:length(plot_timeseries)
@@ -260,23 +252,23 @@ function u_n(timeseries::AbstractArray, n::Int,sol,plott,plot_timeseries,end_idx
260252
end
261253
end
262254

263-
function solplot_vecs_and_labels(dims,vars,plot_timeseries,plott,sol,plot_analytic,end_idx)
255+
function solplot_vecs_and_labels(dims,vars,plot_timeseries,plott,sol,plot_analytic)
264256
plot_vecs = []
265257
for i in 1:dims
266258
push!(plot_vecs,[])
267259
end
268260
labels = String[]# Array{String, 2}(1, length(vars)*(1+plot_analytic))
269261
for x in vars
270262
for j in 1:dims
271-
push!(plot_vecs[j], u_n(plot_timeseries, x[j],sol,plott,plot_timeseries,end_idx))
263+
push!(plot_vecs[j], u_n(plot_timeseries, x[j],sol,plott,plot_timeseries))
272264
end
273265
add_labels!(labels,x,dims,sol)
274266
end
275267

276268
if plot_analytic
277269
for x in vars
278270
for j in 1:dims
279-
push!(plot_vecs[j], u_n(plot_timeseries, x[j],sol,plott,plot_timeseries,end_idx))
271+
push!(plot_vecs[j], u_n(plot_timeseries, x[j],sol,plott,plot_timeseries))
280272
end
281273
add_analytic_labels!(labels,x,dims,sol)
282274
end

0 commit comments

Comments
 (0)