@@ -412,34 +412,14 @@ function add_labels!(labels, x, dims, sol, strs)
412
412
end
413
413
414
414
function add_analytic_labels! (labels, x, dims, sol, strs)
415
- lys = []
416
- for j in 3 : dims
417
- if x[j] == 0 && dims == 2
418
- push! (lys, " $(getindepsym_defaultt (sol)) ," )
419
- else
420
- if strs != = nothing
421
- push! (lys, string (" True " , strs[x[j]], " ," ))
422
- else
423
- push! (lys, " True u$(x[j]) ," )
424
- end
425
- end
426
- end
427
- lys[end ] = lys[end ][1 : (end - 1 )] # Take off the last comma
428
- if x[2 ] == 0
429
- tmp_lab = " $(lys... ) ($(getindepsym_defaultt (sol)) )"
430
- else
431
- if strs != = nothing
432
- tmp = string (" True " , strs[x[2 ]])
433
- tmp_lab = " ($tmp ,$(lys... ) )"
434
- else
435
- tmp_lab = " (True u$(x[2 ]) ,$(lys... ) )"
436
- end
437
- end
438
- if x[1 ] != DEFAULT_PLOT_FUNC
439
- push! (labels, " $(x[1 ])$(tmp_lab) " )
415
+ if ((x[2 ] isa Integer && x[2 ] == 0 ) || isequal (x[2 ],getindepsym_defaultt (sol))) && dims == 2
416
+ push! (labels, " True $(strs[end ]) " )
417
+ elseif x[1 ] != = DEFAULT_PLOT_FUNC
418
+ push! (labels, " True f($(join (strs, ' ,' )) )" )
440
419
else
441
- push! (labels, tmp_lab )
420
+ push! (labels, " True ( $( join (strs, ' , ' )) ) " )
442
421
end
422
+ labels
443
423
end
444
424
445
425
function solplot_vecs_and_labels (dims, vars, plott, sol, plot_analytic,
@@ -486,27 +466,39 @@ function solplot_vecs_and_labels(dims, vars, plott, sol, plot_analytic,
486
466
for x in vars
487
467
tmp = []
488
468
strs = String[]
489
- for j in 2 : dims
469
+ for j in 2 : length (x)
490
470
if (x[j] isa Integer && x[j] == 0 )
491
471
push! (tmp, plott)
492
472
push! (strs, " t" )
493
473
elseif isequal (x[j],getindepsym_defaultt (sol))
494
474
push! (tmp, plott)
495
475
push! (strs, String (getname (x[j])))
496
- elseif n == 1 && ! (sol[:, 1 ] isa Union{AbstractArray, ArrayPartition})
497
- push! (tmp,timeseries)
498
- push! (strs, String (getname (x[j])))
476
+ elseif x[j] == 1 && ! (sol[:, 1 ] isa Union{AbstractArray, ArrayPartition})
477
+ push! (tmp,plot_analytic_timeseries)
478
+ if ! isempty (varsyms) && x[j] isa Integer
479
+ push! (strs, String (getname (varsyms[x[j]])))
480
+ elseif hasname (x[j])
481
+ push! (strs, String (getname (x[j])))
482
+ else
483
+ push! (strs, " u[$(x[j]) ]" )
484
+ end
499
485
else
500
486
_tmp = Vector {eltype(sol[1])} (undef, length (plot_timeseries))
501
487
for j in 1 : length (plot_timeseries)
502
488
_tmp[j] = plot_timeseries[j][n]
503
489
end
504
490
push! (tmp,_tmp)
505
- push! (strs, String (getname (x[j])))
491
+ if ! isempty (varsyms) && x[j] isa Integer
492
+ push! (strs, String (getname (varsyms[x[j]])))
493
+ elseif hasname (x[j])
494
+ push! (strs, String (getname (x[j])))
495
+ else
496
+ push! (strs, " u[$(x[j]) ]" )
497
+ end
506
498
end
507
499
end
508
500
f = x[1 ]
509
- tmp = f .( tmp... )
501
+ tmp = map (f, tmp... )
510
502
tmp = tuple ((getindex .(tmp, i) for i in eachindex (tmp[1 ])). .. )
511
503
for i in eachindex (tmp)
512
504
push! (plot_vecs[i], tmp[i])
0 commit comments