1
$\begingroup$

I'm trying to graph something for a paper and I want to highlight two points in two function. I am using this code:

    Show[
 Plot[f[x, 50, .5, 1, .8, 3], {x, -3, 3}, PlotRange -> All, 
  Epilog -> {Red, PointSize[Large], 
    Point[{x[0, 50, .5, 1, .8, 3], 
      f[x[0, 50, .5, 1, .8, 3], 50, .5, 1, .8, 3]}]}],
 Plot[f[x, 50, .5, .7, .8, 3], {x, -3, 3}, PlotRange -> All, 
  Epilog -> {Green, PointSize[Large], 
    Point[{x[0, 50, .5, .7, .8, 3], 
      f[x[0, 50, .5, .7, .8, 3], 50, .5, .7, .8, 3]}]}]]

Where

x[cost_, t_, teta_, qa_, qv_, b_] := 
 2 Log[((3/2)*cost + 
      Sqrt[(cost^2)*(9/4) + 4 (((t - b) t)^1.5) (1 + teta) qa*qv])] - 
  2 Log[2 (1 + teta) qa (t - b)^1.5]

f[x_, t_, teta_, qa_, qv_, 
   b_] := ((t - b)^1.5)*
    qa*(1 + teta) E^(-1/8) (1 - Erf[(2 x - 1)/Sqrt[8]]) + (t^1.5)*qv*
    E^(-1/8)*(1 + Erf[(2 x + 1)/Sqrt[8]])

My output however only shows one of the points...Am I doing anything wrong or is it just the programme? img

Thank you in advance.

$\endgroup$
1

1 Answer 1

2
$\begingroup$

The value of Epilog option for Show is taken from the first plot, so the one from the second plot is ignored. As alternative, simply specify the Epilog directly in Show.

epi1 = {Red, PointSize[Large], 
   Point[{x[0, 50, .5, 1, .8, 3], 
     f[x[0, 50, .5, 1, .8, 3], 50, .5, 1, .8, 3]}]};
epi2 = {Green, PointSize[Large], 
   Point[{x[0, 50, .5, .7, .8, 3], 
     f[x[0, 50, .5, .7, .8, 3], 50, .5, .7, .8, 3]}]};
Show[
 Plot[f[x, 50, .5, .7, .8, 3], {x, -3, 3}],
 Plot[f[x, 50, .5, 1, .8, 3], {x, -3, 3}],
 Epilog -> {epi1, epi2},
 PlotRange -> All
 ]

enter image description here

Btw., this has the same effect and is somewhat more transparent to me:

Show[
 Plot[f[x, 50, .5, .7, .8, 3], {x, -3, 3}],
 Plot[f[x, 50, .5, 1, .8, 3], {x, -3, 3}],
 Graphics[{epi1, epi2}],
 PlotRange -> All
 ]
$\endgroup$
2
  • $\begingroup$ Thank you very much! $\endgroup$
    – MarV
    Aug 24, 2018 at 11:43
  • $\begingroup$ You're welcome! $\endgroup$ Aug 24, 2018 at 12:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.