Skip to content

Commit be09c8d

Browse files
Merge pull request #2014 from xlxs4/plot-vars-to-idxs
[docs] Change plot vars to idxs
2 parents d8eb9e2 + 6bc65c3 commit be09c8d

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

docs/src/examples/higher_order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ p = [σ => 28.0,
5555
tspan = (0.0,100.0)
5656
prob = ODEProblem(sys,u0,tspan,p,jac=true)
5757
sol = solve(prob,Tsit5())
58-
using Plots; plot(sol,vars=(x,y))
58+
using Plots; plot(sol,idxs=(x,y))
5959
```

docs/src/examples/modelingtoolkitize_index_reduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ traced_sys = modelingtoolkitize(pendulum_prob)
3232
pendulum_sys = structural_simplify(dae_index_lowering(traced_sys))
3333
prob = ODAEProblem(pendulum_sys, [], tspan)
3434
sol = solve(prob, Tsit5(),abstol=1e-8,reltol=1e-8)
35-
plot(sol, vars=states(traced_sys))
35+
plot(sol, idxs=states(traced_sys))
3636
```
3737

3838
## Explanation
@@ -150,7 +150,7 @@ prob = ODEProblem(pendulum_sys, Pair[], tspan)
150150
sol = solve(prob, Rodas4())
151151
152152
using Plots
153-
plot(sol, vars=states(traced_sys))
153+
plot(sol, idxs=states(traced_sys))
154154
```
155155

156156
Note that plotting using `states(traced_sys)` is done so that any
@@ -169,7 +169,7 @@ traced_sys = modelingtoolkitize(pendulum_prob)
169169
pendulum_sys = structural_simplify(dae_index_lowering(traced_sys))
170170
prob = ODAEProblem(pendulum_sys, Pair[], tspan)
171171
sol = solve(prob, Tsit5(),abstol=1e-8,reltol=1e-8)
172-
plot(sol, vars=states(traced_sys))
172+
plot(sol, idxs=states(traced_sys))
173173
```
174174

175175
And there you go: this has transformed the model from being too hard to

docs/src/examples/spring_mass.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,5 +197,5 @@ sol[mass.pos[1]]
197197
We can also plot the path of the mass:
198198

199199
```@example component
200-
plot(sol, vars = (mass.pos[1], mass.pos[2]))
200+
plot(sol, idxs = (mass.pos[1], mass.pos[2]))
201201
```

docs/src/tutorials/acausal_components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,5 +376,5 @@ sol[resistor.v]
376376
or we can plot the timeseries of the resistor's voltage:
377377

378378
```@example acausal
379-
plot(sol, vars=[resistor.v])
379+
plot(sol, idxs=[resistor.v])
380380
```

test/lowering_solving.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ probexpr = ODEProblemExpr(sys, u0, tspan, p, jac = true)
3535
sol = solve(prob, Tsit5())
3636
solexpr = solve(eval(prob), Tsit5())
3737
@test all(x -> x == 0, Array(sol - solexpr))
38-
#using Plots; plot(sol,vars=(:x,:y))
38+
#using Plots; plot(sol,idxs=(:x,:y))
3939

4040
@parameters t σ ρ β
4141
@variables x(t) y(t) z(t)
@@ -73,4 +73,4 @@ tspan = (0.0, 100.0)
7373
prob = ODEProblem(connected, u0, tspan, p)
7474
sol = solve(prob, Rodas5())
7575
@test maximum(sol[2, :] + sol[6, :] + 2sol[1, :]) < 1e-12
76-
#using Plots; plot(sol,vars=(:α,Symbol(lorenz1.x),Symbol(lorenz2.y)))
76+
#using Plots; plot(sol,idxs=(:α,Symbol(lorenz1.x),Symbol(lorenz2.y)))

test/structural_transformation/index_reduction.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ prob = ODEProblem(ODEFunction(first_order_idx1_pendulum),
7070
[1, 9.8],
7171
mass_matrix = calculate_massmatrix(first_order_idx1_pendulum))
7272
sol = solve(prob, Rodas5());
73-
#plot(sol, vars=(1, 2))
73+
#plot(sol, idxs=(1, 2))
7474

7575
new_sys = dae_index_lowering(ModelingToolkit.ode_order_lowering(pendulum2))
7676

@@ -83,7 +83,7 @@ prob_auto = ODEProblem(new_sys,
8383
(0, 100.0),
8484
[1, 9.8])
8585
sol = solve(prob_auto, Rodas5());
86-
#plot(sol, vars=(x, y))
86+
#plot(sol, idxs=(x, y))
8787

8888
# Define some variables
8989
@parameters t L g
@@ -116,7 +116,7 @@ p = [
116116

117117
prob_auto = ODEProblem(new_sys, u0, (0.0, 10.0), p)
118118
sol = solve(prob_auto, Rodas5());
119-
#plot(sol, vars=(D(x), y))
119+
#plot(sol, idxs=(D(x), y))
120120

121121
let pss_pendulum2 = partial_state_selection(pendulum2)
122122
@test length(equations(pss_pendulum2)) <= 6

0 commit comments

Comments
 (0)