I plotted a line with this code:
Manipulate[Plot[y = m (x - a) + b, {x, -10, 10}],
{m, -10, 10}, {a, -10, 10}, {b, -10, 10}]
When I change the m (slope of the line) with the slider the axis get's re-sized and the line get's move up or down and finally flipped over but I want to see how the line rotates around without the axis moving and re-sizing. What should I do?
By default, all Plot
type functions in mathematica have the property PlotRange->Automatic
. That is, it tells Mathematica to take the best guess as to the range given the function.
Since the plot is recalculated (and hence the plot range as well) at each change of m
, it changes the range it shows, leading to the behavior you describe.
What you need to do is specify the range to plot ahead of time, so that it doesn't change:
Manipulate[
Plot[y = m (x - a) + b, {x, -10, 10}, PlotRange -> {-200, 200}]
, {m, -10, 10}, {a, -10, 10}, {b, -10, 10}]
PS. You should post future MMA questions to http://Mathematica.StackExchange.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With