Skip to content

Commit bc8de61

Browse files
authored
Merge pull request #506 from control-toolbox/505-general-update-with-ctmodels-v036
foo
2 parents b2fcefc + ee981e5 commit bc8de61

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ If you want to ask a question, feel free to start a discussion [here](https://gi
121121
122122
## See also
123123

124-
We acknowledge support of colleagues from [ADNLPModels](https://jso.dev/ADNLPModels.jl/stable) @[Julia Smooth Optimizers](https://jso.dev) and [MadNLP](https://github.com/MadNLP/MadNLP.jl).
124+
We acknowledge support of colleagues from [ADNLPModels](https://jso.dev/ADNLPModels.jl/stable) @[Julia Smooth Optimizers](https://jso.dev) and [MadNLP](https://github.com/MadNLP/MadNLP.jl).

docs/src/tutorial-plot.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function plot(
1717
control, # plot the norm or components of the control
1818
time, # normalise the time or not
1919
size, # size of the figure
20-
solution_label, # suffix for the labels
2120
state_style, # style for the state trajectory
2221
costate_style, # style for the costate trajectory
2322
control_style, # style for the control trajectory
@@ -33,10 +32,11 @@ In the following, we detail the roles of the arguments.
3332
| [Split versus group layout](@ref tutorial-plot-layout) | `layout` |
3433
| [Plot the norm of the control](@ref tutorial-plot-control) | `control` |
3534
| [Normalised time](@ref tutorial-plot-time) | `time` |
36-
| [Add a plot](@ref tutorial-plot-add) | `solution_label` |
3735

3836
You can plot a solution obtained from the `solve` function, as well as from the flow computed using an optimal control problem and a control law. See, respectively, [Basic Concepts](@ref tutorial-plot-basic) and [From Flow](@ref tutorial-plot-flow) sections for more details.
3937

38+
You can [add a plot](@ref tutorial-plot-add) to an existing one, thanks to the `plot!` function.
39+
4040
You can also retrieve the state, the costate and the control to create your own plots, see [Custom plot](@ref tutorial-plot-custom) section.
4141

4242
## The problem and the solution
@@ -169,7 +169,7 @@ plot(sol_flow)
169169
If you prefer to get a more compact figure, you can use the `layout` optional keyword argument with `:group` value. It will group the state, costate and control trajectories in one subplot for each.
170170

171171
```@example main
172-
plot(sol; layout=:group, size=(800, 300))
172+
plot(sol; layout=:group)
173173
```
174174

175175
The default layout value is `:split` which corresponds to the grid of subplots presented above.
@@ -204,8 +204,8 @@ nothing # hide
204204
We first plot the solution of the first optimal control problem, then, we plot the solution of the second optimal control problem on the same figure, but with dashed lines.
205205

206206
```@example main
207-
plt = plot(sol; solution_label="(sol1)", size=(700, 500))
208-
plot!(plt, sol2; solution_label="(sol2)", linestyle=:dash)
207+
plt = plot(sol; label="sol1", size=(700, 500))
208+
plot!(plt, sol2; label="sol2", linestyle=:dash)
209209
```
210210

211211
## [Plot the norm of the control](@id tutorial-plot-control)
@@ -229,10 +229,8 @@ You can, of course, create your own plots by extracting the `state`, `costate`,
229229
```@example main
230230
using LinearAlgebra
231231
t = time_grid(sol)
232-
x = state(sol)
233-
p = costate(sol)
234232
u = control(sol)
235-
plot(t, norm∘u; label="‖u‖")
233+
plot(t, norm∘u; label="‖u‖", xlabel="t")
236234
```
237235

238236
!!! note "Nota bene"

0 commit comments

Comments
 (0)