# Dynamic plot with button and slider [closed]

How can I create a dynamic, interactive graph in Mathematica with buttons and sliders for changing the equation type and variables?

• You can do it by reading documentation, which is excellent. Jan 31 at 6:57
• have you seen Manipulate? There are over 12,000 examples at demonstrations.wolfram.com Jan 31 at 9:43
• I forgot my manners. A proper welcome with some useful links hopefully
– bmf
Jan 31 at 10:48
• Welcome to Mathematica S.E. To start: 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, since the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) consider accepting the answer, if any, that solves your problem, by clicking checkmark sign, 4) give help too, by answering questions in your areas of expertise.
– bmf
Jan 31 at 10:48

g = 1;
dm = DynamicModule[{a},
Column[{Dynamic@
Plot[Sin[(a + g) x], {x, 0, Pi}, PlotRange -> {All, {-1, 1}}],
Slider[Dynamic@a, {0, 4}]}]];
Button["g++", g = g + 1]
Dynamic[dm] Edit: many thanks to @Nasser for the comment. Indeed, Manipulate might be more straightforward. It works like this:

g = 1;
Manipulate[
Plot[Sin[(a + g) x], {x, 0, 2 Pi}, PlotLabel -> Row[{"a=", a}]], {a,
0, 5}]
Button["g++", g = g + 1]

• nice example but I find Manipulate much simpler myself. Jan 31 at 9:44
• @Nasser thanks for pointing this out. I have adopted your comment in the edit :-)
– bmf
Jan 31 at 9:55