2
$\begingroup$

This code:

f[x_, a_, b_] := a x - b x^3
Manipulate[{Plot[f[x, a, b], {x, -2, 2}], 
  n = -\[Integral]f[x, a, b] \[DifferentialD]x;
  Plot[n, {x, -2, 2}, PlotRange -> Automatic]},
       {{a, 1/2, "control parameter"}, -1, 2, 0.1},
       {{b, 1/4, "control parameter 2"}, -1, 2, 0.01}]

Produces this: (if one starts automatic play)

enter image description here

But this looks unprofessional because of annoying up-down movements.

What can be done to stop shaking?

$\endgroup$
3
  • $\begingroup$ Instead of Automatic, you must set an explicit PlotRange. $\endgroup$ Jun 9, 2015 at 10:18
  • $\begingroup$ @Guesswhoitis. But what if I want to keep variable plot range? $\endgroup$
    – VividD
    Jun 9, 2015 at 10:20
  • $\begingroup$ You'll have to provide for a way to vary the PlotRange somewhere in your Manipulate[]. $\endgroup$ Jun 9, 2015 at 10:27

1 Answer 1

8
$\begingroup$

use ImagePadding as in

f[x_, a_, b_] := a x - b x^3
Manipulate[
 {
  Plot[f[x, a, b], {x, -2, 2}, ImagePadding -> 5],
  n = -Integrate[f[x, a, b] , x];
  Plot[n, {x, -2, 2}, PlotRange -> Automatic, ImagePadding -> 5]
  },
 {{a, 1/2, "control parameter"}, -1, 2, 0.1},
 {{b, 1/4, "control parameter 2"}, -1, 2, 0.01}
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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