# How can I adjust the size of this parametric plot output? [closed]

I have a problem with the dimensions of the output of a ParametricPlot. What I'm trying to do is solve a differential equation using NDSolve and then make the resulting plot interactive so you can follow the solution as it changes through time. This is the code I have:

s = NDSolve[{Derivative[2][x][t] == x[t]^2, x[0] == 1,
Derivative[1][x][0] == 0}, x,
{t, 0, 2}];
DynamicModule[{tr = 1}, Column[{ti = 1, tf = 2,
Show[ParametricPlot[Evaluate[{t, x[t]} /. s], {t, ti, tf},
PlotStyle -> Directive[Thin, Gray]],

Graphics[{Dynamic[First[ParametricPlot[Evaluate[{t, x[t]} /. s],
{t, ti + 0.0001, tr}, PlotRange -> All,
PlotStyle -> Thick]] /.
Line -> Arrow]}], AspectRatio -> Automatic],
Slider[Dynamic[tr], {ti, tf}]}]]


With this code, I get the following output

This is the correct plot, however, I think the axes proportions are not the best. I would want to compact the vertical axis and stretch the horizontal one.

I was looking for solutions to this problem and I found that AspectRatio -> Automatic should have adjusted the size based on the values of the plot. I tried this in the code I posted above, but it didn't solve the issue.

Could anyone tell me how I could correct this problem?

Also, I'm pretty new to Mathematica, so if the code is messy I apologize. It's basically put together by trying to stitch together examples from the documentation, so any suggestions about how I could change my code to make it better are also very much appreciated. Thank you very much!

• Try the potion AspectRatio->0.7 and play a bit with its value. Jun 18 '21 at 20:56
• @Alexei_Boulbitch -- The OP also needs to move the AspectRatio specification to the first of the ParametricPlots in the Show. I don't know where I learned this, but I don't remember seeing it discussed in the documentation ;-) Jun 19 '21 at 2:38
• @RobertLee -- Welcome to the forum! I think you've done great for being "...pretty new to Mathematica..." You've run into some tricky and not so well-document issues. Answer and things to try below. Jun 19 '21 at 3:20

Show[] uses AspectRatio and ImageSize from the first listed ParametricPlot.

I also specified the AspectRatio.

s = NDSolve[{Derivative[2][x][t] == x[t]^2, x[0] == 1,
Derivative[1][x][0] == 0}, x, {t, 0, 2}];
DynamicModule[{tr = 1},
Column[
{ti = 1,
tf = 2,
Show[
ParametricPlot[
Evaluate[{t, x[t]} /. s], {t, ti, tf},
PlotStyle -> Directive[Thin, Gray],
AspectRatio -> 1/GoldenRatio,
ImageSize -> 350],
Graphics[{
Dynamic[
First[
ParametricPlot[
Evaluate[{t, x[t]} /. s], {t, ti + 0.0001, tr},
PlotRange -> All,
PlotStyle -> Thick]] /. Line -> Arrow]
}
]
],
Slider[Dynamic[tr], {ti, tf}]}]]


Using Manipulate might simplify what you want to do in the future, e.g.,

s = NDSolve[{
Derivative[2][x][t] == x[t]^2, x[0] == 1,
Derivative[1][x][0] == 0}, x, {t, 0, 2}];
ti = 1;
tf = 2;

Manipulate[
Column[{
ti,
tf,
Show[
ParametricPlot[
Evaluate[{t, x[t]} /. s], {t, ti, tf},
PlotStyle -> Directive[Thin, Gray],
AspectRatio -> 1/GoldenRatio,
ImageSize -> 350],
ParametricPlot[
Evaluate[{t, x[t]} /. s], {t, ti + 0.0001, tr},
PlotRange -> All,
PlotStyle -> Thick]] /. Line -> Arrow
}],
{tr, 0, 2}
]


• Thank you so much for your answer! I now see that I should have declared AspectRatio -> Automatic earlier. Thank you again for your help. Jun 19 '21 at 7:26