# Strange behavior with Show command [duplicate]

I enter this:

sol17 = DSolveValue[{y'[x] == 2 - y[x], y == 3}, y[x], x];
p1sol17 = Plot[sol17, {x, -3, 3},
Epilog -> {Red, PointSize[Large], Point[{0, 3}],
Text[Style["(0,3)", 10, Black, Background -> White], {0,
3}, {-2, -2}]}]


And I get the following image: I do this:

sol17 = DSolveValue[{y'[x] == 2 - y[x], y == 1}, y[x], x];
p2sol17 = Plot[sol17, {x, -3, 3},
Epilog -> {Red, PointSize[Large], Point[{0, 1}],
Text[Style["(0,1)", 10, Black, Background -> White], {0, 1}, {-2,
2}]}]


And I get the following image: Now I try to combine them with the Show command:

Show[{p1sol17, p2sol17}, PlotRange -> {{-3, 3}, {-10, 10}}]


And I get this image: Note how the bottom curve is incorrect? What is going on here?

Mathematica 10.0.2 on MacBook Pro using Yosemite.

It's not actually that the bottom plot is incorrect, it's that the horizontal axis is not drawn where you expect it. Consider this simplification, where it is more clear that the position of the horizontal axes are placed differently. Since Show inherits many of the plotting features from the first argument, the order of the plots matters in the placement of the axes.

sol17 = DSolveValue[{y'[x] == 2 - y[x], y == 3}, y[x], x];
sol27 = DSolveValue[{y'[x] == 2 - y[x], y == 1}, y[x], x];
Show[{Plot[sol27, {x, -3, 3}], Plot[sol17, {x, -3, 3}]},
PlotRange -> {-1, 3}]
Show[{Plot[sol17, {x, -3, 3}], Plot[sol27, {x, -3, 3}]},
PlotRange -> {-1, 3}]  • Also, the second dot disappears because Epilog is a graphics option. Show concatenates the options, and only the first is applied (e.g. try Plot[x^2,{x,-1,1},PlotStyle->Red,PlotStyle->Green]). – 2012rcampion Jan 24 '15 at 20:51
• Great catch, on looking at the original curve it is clear that the x axis was drawn at y=1. – March Ho Jan 24 '15 at 21:22

Thanks for the help. I came up with two solutions that worked.

Show[p1sol17, p2sol17,
Graphics[{Red, PointSize[Large], Point[{{0, 3}, {0, 1}}],
Black,
Text["(0,3)", {0, 3}, {-2, -2}],
Text["(0,1)", {0, 1}, {-2, 2}]}],
AxesOrigin -> {0, 0},
AxesLabel -> {x, y},
PlotRange -> {{-3, 3}, {-10, 10}}
]


Which produced the correct image. And a second approach:

sol = Table[
DSolveValue[{y'[x] == 2 - y[x], y == b}, y[x],
x], {b, {1, 3}}];
Plot[sol, {x, -3, 3},
Epilog -> {
Red, PointSize[Large], Point[{{0, 3}, {0, 1}}],
Black,
Text["(0,3)", {0, 3}, {-2, -2}],
Text["(0,1)", {0, 1}, {-2, 2}]
},
AxesOrigin -> {0, 0},
AxesLabel -> {x, y},
PlotRange -> {{-3, 3}, {-10, 10}}]


Which produced this image: So, you can see that your help was successful!