In the following code, the line defined in Epilog
option of my 2nd parametric plot doesn't show up in the content pane of my Manipulate
expression.
ClearAll[θ1, θ2];
m1 = 1;
m2 = 1;
lc1 = 1;
lc2 = 1;
l1 = 2;
l2 = 2;
Ix2 = 1;
Iy2 = 1;
Iz1 = 1;
Iz2 = 1;
m11[t_] :=
m1*(lc1)^2 + m2*(l1 + lc2*Cos[θ2[t]])^2 + Ix2*(Sin[θ2[t]])^2 +
Iy2*(Cos[θ2[t]])^2 + Iz1;
m22[t_] := m2*(lc2)^2 + Iz2;
V11[t_] := 0;
V12[t_] :=
(-2*m2*lc2*(l1 + lc2*Cos[θ2[t]])*Sin[θ2[t]] +
2 (Ix2 - Iy2)*Sin[θ2[t]]*Cos[θ2[t]])*θ1'[t];
V21[t_] :=
(m2*lc2*(l1 + lc2*Cos[θ2[t]])*Sin[θ2[t]] -
(Ix2 - Iy2)*Sin[θ2[t]]*Cos[θ2[t]])*θ1'[t];
V22[t_] := 0;
M = {{m11[t], 0}, {0, m22[t]}};
V = {{V11[t], V12[t]}, {V21[t], V22[t]}};
G = {{0, 0}, {0, 0}};
initu = q[0] == {{0}, {.1}};
initv = q'[0] == {{0}, {0}};
q[t_] := {θ1[t], θ2[t]};
sol =
First @
NDSolve[{
Thread[M.q''[t] + V.q'[t] + G.q[t] == {Sin[2 t], Sin[2 t]}],
initu, initv}, q[t], {t, 0, 100}];
Plot[{θ1[t] /. sol, θ2[t] /. sol}, {t, 0, 100}, PlotTheme -> "Detailed"]
Manipulate[
Show[
ParametricPlot[{Evaluate[{l1*Cos[θ1[t]], l1*Sin[θ1[t]]} /. sol]}, {t, 0, a},
AspectRatio -> 1,
PlotRange -> {{-5, 5}, {-5, 5}},
Epilog ->
Line[{{0, 0}, {l1*Cos[θ1[t]], l1*Sin[θ1[t]]}}]],
ParametricPlot[{
Evaluate[{l1*Cos[θ1[t]] + l2*Cos[θ1[t] + θ2[t]],
l1*Sin[θ1[t]] + l2*Sin[θ1[t] + θ2[t]]} /. sol]},
{t, 0, a},
AspectRatio -> 1,
PlotRange -> {{-5, 5}, {-5, 5}},
Epilog ->
Line[{{0, 0},
{l1*Cos[θ1[t]] + l2*Cos[θ1[t] + θ2[t]],
l1*Sin[θ1[t]] + l2*Sin[θ1[t] + θ2[t]]}}]]],
{a, 0.001, 100}]
Show
multiple plots, only the first plotsEpilog
gets used. $\endgroup$Epilog
setting inShow[]
and not in any of the inner plots. $\endgroup$Show
documentation page: "Show uses the options from the first graphic:" $\endgroup$Epilog
/Prolog
of each? I think that would be more helpful to site visitors. Other solutions may be offered as well. $\endgroup$