1
$\begingroup$

This question already has an answer here:

I start with:

With[{r = 0.3, q = 10},
 ans = NSolve[r u (1 - u/q) - u^2/(1 + u^2) == 0, u]
 ]

Then:

With[{r = 0.3, q = 10},
 vp = VectorPlot[{1, r u (1 - u/q) - u^2/(1 + u^2)},
   {t, 0, 12}, {u, 0, 0.8},
   PlotRange -> {{0, 12}, {0, 0.8}},
   VectorScale -> {0.03, 0.03, None},
   VectorPoints -> 16,
   VectorStyle -> {GrayLevel[0.8]},
   Axes -> True, AxesLabel -> {t, u}]
 ]

Which produces this plot.

enter image description here

Then:

pfun = ParametricNDSolveValue[
   {u'[t] == r u [t] (1 - u[t]/q) - u[t]^2/(1 + u[t]^2), u[0] == a},
   u, {t, 0, 12}, {r, q, a}];
With[{r = .3, q = 10},
 plt3 = Plot[
   Evaluate@Table[pfun[r, q, a][t], {a, 0.1, 0.7, 0.1}], {t, 0, 12},
   PlotStyle -> Blue,
   PlotRange -> {{0, 12}, {0, 0.8}},
   Epilog -> {{Red, Thick, Dashed, Line[{{0, 0}, {12, 0}}]},
     {Red, Line[{{0, u}, {12, u}} /. ans[[3]]]}}]
 ]

Which produces this plot.

enter image description here

But here is what happens with the Show command.

Show[vp, plt3]

Plot result.

enter image description here

See, my red equilibrium solutions don't show up in the Show command. Reason? I know I can fix this with Graphics added to Show command, but I am wondering why this doesn't work.

Proving Guess who it is's Comment

pfun = ParametricNDSolveValue[
   {u'[t] == r u [t] (1 - u[t]/q) - u[t]^2/(1 + u[t]^2), u[0] == a},
   u, {t, 0, 12}, {r, q, a}];

With[{r = 0.3, q = 10},
  ans = NSolve[r u (1 - u/q) - u^2/(1 + u^2) == 0, u];
  vp = VectorPlot[{1, r u (1 - u/q) - u^2/(1 + u^2)},
    {t, 0, 12}, {u, 0, 0.8},
    PlotRange -> {{0, 12}, {0, 0.8}},
    VectorScale -> {0.03, 0.03, None},
    VectorPoints -> 16,
    VectorStyle -> {GrayLevel[0.8]},
    Axes -> True, AxesLabel -> {t, u},
    Epilog -> {{Red, Thick, Dashed, Line[{{0, 0}, {12, 0}}]},
      {Red, Line[{{0, u}, {12, u}} /. ans[[3]]]}}];
  plt3 = Plot[
    Evaluate@Table[pfun[r, q, a][t], {a, 0.1, 0.7, 0.1}], {t, 0, 12},
    PlotStyle -> Blue,
    PlotRange -> {{0, 12}, {0, 0.8}}]
  ];
Show[vp, plt3]

enter image description here

$\endgroup$

marked as duplicate by Yves Klett, Sjoerd C. de Vries, Simon Woods, bbgodfrey, C. E. May 3 '15 at 17:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ That's because your Show[] command inherits its Epilog setting from the first plot and not the second. $\endgroup$ – J. M. is away May 3 '15 at 4:58
  • $\begingroup$ @Guesswhoitis. Your answer seems correct. See addition to my post. $\endgroup$ – David May 3 '15 at 5:29
  • $\begingroup$ This is mentioned in the Possible Issues section of the Show documentation page. $\endgroup$ – Sjoerd C. de Vries May 3 '15 at 7:54

Browse other questions tagged or ask your own question.