@@ -1112,6 +1112,47 @@ function Plots.plot!(
11121112 kwargs... ,
11131113)
11141114
1115+ model = CTModels. model (sol)
1116+
1117+ # check if the plot is empty
1118+ if isempty (p. series_list)
1119+
1120+ attr = NamedTuple ((Symbol (key),value) for (key,value) in p. attr if key != :layout )
1121+
1122+ pnew = __initial_plot (
1123+ sol,
1124+ description... ;
1125+ layout= layout,
1126+ control= control,
1127+ model= model,
1128+ size= __size_plot (
1129+ sol,
1130+ model,
1131+ control,
1132+ layout,
1133+ description... ;
1134+ state_style= state_style,
1135+ control_style= control_style,
1136+ costate_style= costate_style,
1137+ path_style= path_style,
1138+ dual_style= dual_style,
1139+ ),
1140+ state_style= state_style,
1141+ control_style= control_style,
1142+ costate_style= costate_style,
1143+ path_style= path_style,
1144+ dual_style= dual_style,
1145+ attr... ,
1146+ kwargs... ,
1147+ )
1148+
1149+ # replace p by pnew, must have a side effect
1150+ for k ∈ fieldnames (typeof (p))
1151+ setfield! (p, k, getfield (pnew, k))
1152+ end
1153+
1154+ end
1155+
11151156 # plot the solution with infos from the model
11161157 return __plot! (
11171158 p,
@@ -1124,7 +1165,7 @@ function Plots.plot!(
11241165 state_style= state_style,
11251166 control_style= control_style,
11261167 costate_style= costate_style,
1127- model= CTModels . model (sol) ,
1168+ model= model,
11281169 state_bounds_style= state_bounds_style,
11291170 control_bounds_style= control_bounds_style,
11301171 time_style= time_style,
0 commit comments