# Plotting a graph of a function and part of it

I am doing a numerical experiment for solving some differential equation. In some part I need to plot a graph of the exact and approximated solutions. However, they are very closed to each other and it is difficult to graphically show how the approximated solution is related to the exact one. My question is how I can show the plot in two graphs, one showing the graph with its approximated solution (no problem if t is not clear how they are closed to each other) and another one beside it showing part of this graph in a very short domain in order to graphically represent how they are closed to each other. You can consider y=x^2 as exact solution and we need to show another plot beside the graph of y in a very small domain. I am interested to show the second graph by putting a small box on the graph of y and direct an arrow to the other graph showing this domain that assigned by the square we already constructed. Hope it is clear. looking for your help!

Please look t the plots below. One is for the domain [-1,1] and the other with a small domain and it is clear how the approximated solution behaves.

• Why don't you plot their difference? – Szabolcs Apr 20 at 18:22
• I did. But I need to show the exact and approximated solution together – Mutaz Apr 20 at 18:24
• It can be done with Inset. You can take a look at its documentation page while waiting for someone to post an answer. – Szabolcs Apr 20 at 19:05

Here is a starting for you.

inset = Inset[
Plot[u^2, {u, 0.05, 0.25}, Frame -> True,
FrameTicks -> {{None, All}, {None, All}} , ImageSize -> 150],
Scaled[{0.5, 0.7}]];
Show[Plot[x^2, {x, -1, 1}, Frame -> True, Axes -> False,
Epilog -> {inset}],
Graphics[{FaceForm[], EdgeForm[Black],
Rectangle[{0.05, 0}, {0.25, 0.06}], Dashed, GrayLevel[0.5],
Line[{{0.05, 0.06}, {-0.42, 0.5}}],
Line[{{0.25, 0.06}, {0.3, 0.49}}]}]]


• Thank you so much Okkes! – Mutaz Apr 21 at 10:05