@@ -216,6 +216,7 @@ function __initial_plot(
216216
217217 # check what to plot
218218 do_plot_state, do_plot_costate, do_plot_control, do_plot_path, do_plot_dual = do_plot (
219+ sol,
219220 description... ;
220221 state_style= state_style,
221222 control_style= control_style,
@@ -449,6 +450,7 @@ function __plot!(
449450
450451 # check what to plot
451452 do_plot_state, do_plot_costate, do_plot_control, do_plot_path, do_plot_dual = do_plot (
453+ sol,
452454 description... ;
453455 state_style= state_style,
454456 control_style= control_style,
@@ -1040,119 +1042,14 @@ function __plot(
10401042end
10411043
10421044# --------------------------------------------------------------------------------------------------
1043- # public plots: from a solution
1044- """
1045- $(TYPEDSIGNATURES)
1046-
1047- Plot the optimal control solution `sol` using the layout `layout`.
1048-
1049- **Notes.**
1050-
1051- - The argument `layout` can be `:group` or `:split` (default).
1052- - `control` can be `:components`, `:norm` or `:all`.
1053- - `time` can be `:default` or `:normalize`.
1054- - The keyword arguments `state_style`, `control_style` and `costate_style` are passed to the `plot` function of the `Plots` package. The `state_style` is passed to the plot of the state, the `control_style` is passed to the plot of the control and the `costate_style` is passed to the plot of the costate.
1055- """
1056- function Plots. plot! (
1057- p:: Plots.Plot ,
1058- sol:: CTModels.Solution ,
1059- description:: Symbol... ;
1060- layout:: Symbol = __plot_layout (),
1061- control:: Symbol = __control_layout (),
1062- time:: Symbol = __time_normalization (),
1063- solution_label:: String = __plot_label_suffix (),
1064- state_style:: Union{NamedTuple,Symbol} = __plot_style (),
1065- control_style:: Union{NamedTuple,Symbol} = __plot_style (),
1066- costate_style:: Union{NamedTuple,Symbol} = __plot_style (),
1067- kwargs... ,
1068- )
1069- return __plot! (
1070- p,
1071- sol,
1072- description... ;
1073- layout= layout,
1074- control= control,
1075- time= time,
1076- solution_label= solution_label,
1077- state_style= state_style,
1078- control_style= control_style,
1079- costate_style= costate_style,
1080- model= nothing ,
1081- state_bounds_style= __plot_style (),
1082- control_bounds_style= __plot_style (),
1083- time_style= __plot_style (),
1084- path_style= __plot_style (),
1085- path_bounds_style= __plot_style (),
1086- dual_style= __plot_style (),
1087- kwargs... ,
1088- )
1089- end
1090-
1045+ # public plots
10911046"""
10921047$(TYPEDSIGNATURES)
10931048
10941049Plot the optimal control solution `sol`.
10951050
10961051**Notes.**
10971052
1098- - The argument `layout` can be `:group` or `:split` (default).
1099- - The keyword arguments `state_style`, `control_style` and `costate_style` are passed to the `plot` function of the `Plots` package. The `state_style` is passed to the plot of the state, the `control_style` is passed to the plot of the control and the `costate_style` is passed to the plot of the costate.
1100- """
1101- function Plots. plot (
1102- sol:: CTModels.Solution ,
1103- description:: Symbol... ;
1104- layout:: Symbol = __plot_layout (),
1105- control:: Symbol = __control_layout (),
1106- time:: Symbol = __time_normalization (),
1107- solution_label:: String = __plot_label_suffix (),
1108- state_style:: Union{NamedTuple,Symbol} = __plot_style (),
1109- control_style:: Union{NamedTuple,Symbol} = __plot_style (),
1110- costate_style:: Union{NamedTuple,Symbol} = __plot_style (),
1111- size:: Tuple = __size_plot (
1112- sol,
1113- nothing ,
1114- control,
1115- layout,
1116- description... ;
1117- state_style= state_style,
1118- control_style= control_style,
1119- costate_style= costate_style,
1120- path_style= :none ,
1121- dual_style= :none ,
1122- ),
1123- kwargs... ,
1124- )
1125- return __plot (
1126- sol,
1127- description... ;
1128- layout= layout,
1129- control= control,
1130- time= time,
1131- solution_label= solution_label,
1132- state_style= state_style,
1133- control_style= control_style,
1134- costate_style= costate_style,
1135- model= nothing ,
1136- state_bounds_style= __plot_style (),
1137- control_bounds_style= __plot_style (),
1138- time_style= __plot_style (),
1139- path_style= __plot_style (),
1140- path_bounds_style= __plot_style (),
1141- dual_style= __plot_style (),
1142- size= size,
1143- kwargs... ,
1144- )
1145- end
1146-
1147- # --------------------------------------------------------------------------------------------------
1148- # public plots: from a solution and the model
1149- """
1150- $(TYPEDSIGNATURES)
1151-
1152- Plot the optimal control solution `sol` using the layout `layout`. The model is used to represent the initial and final times and the constraints.
1153-
1154- **Notes.**
1155-
11561053- The argument `layout` can be `:group` or `:split` (default).
11571054- `control` can be `:components`, `:norm` or `:all`.
11581055- `time` can be `:default` or `:normalize`.
@@ -1162,7 +1059,6 @@ Plot the optimal control solution `sol` using the layout `layout`. The model is
11621059function Plots. plot! (
11631060 p:: Plots.Plot ,
11641061 sol:: CTModels.Solution ,
1165- model:: CTModels.Model ,
11661062 description:: Symbol... ;
11671063 layout:: Symbol = __plot_layout (),
11681064 control:: Symbol = __control_layout (),
@@ -1192,7 +1088,7 @@ function Plots.plot!(
11921088 state_style= state_style,
11931089 control_style= control_style,
11941090 costate_style= costate_style,
1195- model= model,
1091+ model= CTModels . model (sol) ,
11961092 state_bounds_style= state_bounds_style,
11971093 control_bounds_style= control_bounds_style,
11981094 time_style= time_style,
@@ -1206,7 +1102,7 @@ end
12061102"""
12071103$(TYPEDSIGNATURES)
12081104
1209- Plot the optimal control solution `sol` using the layout `layout`. The model is used to represent the initial and final times and the constraints .
1105+ Plot the optimal control solution `sol`.
12101106
12111107**Notes.**
12121108
@@ -1216,7 +1112,6 @@ Plot the optimal control solution `sol` using the layout `layout`. The model is
12161112"""
12171113function Plots. plot (
12181114 sol:: CTModels.Solution ,
1219- model:: CTModels.Model ,
12201115 description:: Symbol... ;
12211116 layout:: Symbol = __plot_layout (),
12221117 control:: Symbol = __control_layout (),
@@ -1233,7 +1128,7 @@ function Plots.plot(
12331128 dual_style:: Union{NamedTuple,Symbol} = __plot_style (),
12341129 size:: Tuple = __size_plot (
12351130 sol,
1236- model,
1131+ CTModels . model (sol) ,
12371132 control,
12381133 layout,
12391134 description... ;
@@ -1255,7 +1150,7 @@ function Plots.plot(
12551150 state_style= state_style,
12561151 control_style= control_style,
12571152 costate_style= costate_style,
1258- model= model,
1153+ model= CTModels . model (sol) ,
12591154 state_bounds_style= state_bounds_style,
12601155 control_bounds_style= control_bounds_style,
12611156 time_style= time_style,
0 commit comments