Skip to content

Commit aa3df4c

Browse files
committed
added : option to plot D_data or not
1 parent d3e7c57 commit aa3df4c

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

example/juMPC.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ test_mpc(linModel4, mpc)
156156

157157

158158
res = sim(mpc, x0=zeros(mpc.estim.model.nx))
159-
ps = plot(res)
159+
ps = plot(res, plotD=false, plotŶminŶmax=false, plotUminUmax=false)
160160
display(ps)
161161

162162
#=

src/plots.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ end
1919
plotŶ = false,
2020
plotRu = true,
2121
plotUminUmax = true,
22+
plotD = true
2223
)
2324

2425
mpc = res.mpc
@@ -34,7 +35,7 @@ end
3435
nd = size(res.D_data, 1)
3536

3637

37-
layout := @layout nd 0 ? [(ny,1) (nu,1) (nd, 1)] : [(ny,1) (nu,1)]
38+
layout := @layout (nd 0 && plotD) ? [(ny,1) (nu,1) (nd, 1)] : [(ny,1) (nu,1)]
3839

3940
# these are common to both marginal histograms
4041
#fillcolor := :black
@@ -144,14 +145,16 @@ end
144145
end
145146
end
146147
subplot_base += nu
147-
for i in 1:nd
148-
@series begin
149-
xguide --> "Time (s)"
150-
yguide --> "\$d_$i\$"
151-
color --> 1
152-
subplot --> subplot_base + i
153-
label --> ""
154-
t, res.D_data[i, :]
148+
if plotD
149+
for i in 1:nd
150+
@series begin
151+
xguide --> "Time (s)"
152+
yguide --> "\$d_$i\$"
153+
color --> 1
154+
subplot --> subplot_base + i
155+
label --> ""
156+
t, res.D_data[i, :]
157+
end
155158
end
156159
end
157160
end

0 commit comments

Comments
 (0)