Hot answers tagged manipulate
8
You have to study the documentation carefully, but I agree that help-pages like the one of Manipulate are very densely packed with information. In the Details and Options section you find how to set options for controls:
{{u,...},...,opts} control with particular options
The non-obvious part is, that you have to set the ControlType as well to make ...
7
h = {Disk[], Red, PointSize[Large], Point[{1, 0}]};
r = Image@Total[ImageData /@ (ColorSeparate /@
Table[
Graphics[{Translate[Rotate[h, - 2 t/(Pi)], {t, 0}]},
PlotRange -> {{0, 6 Pi}, {-1, 1}}, Background -> Black],
{t, 0, 6 Pi, 2 Pi/20}])[[All, 1]]]
...
6
The general issue, as mentioned by xzczd, is that Manipulate only "notices" explicit visible parameters. This is because when you evaluate something like Manipulate[x, {x, 0, 1}] and start waggling the slider, you are not changing the value of the global symbol x, but instead a temporary symbol called something like x$$15. You can see this like so:
...
4
This will work. The only change is that I removed the option ControlType and added a "slider function" at the end of the control for v. Note that Pinguin Dirks suggestion in the comments also works, is more convenient and he beat me to it :). Still I guess this code shows how you can have even more control over your slider.
Manipulate[
With[{ar = 1/(2*Pi), ...
4
You can use the LocalizeVariables option:
Manipulate[
ListLinePlot[pdata[[1 ;; m]], PlotRange -> {{-20, 20}, {0, 45}}],
{m, 1, Length[pdata], 1}, LocalizeVariables -> False],
Manipulate[
ListLinePlot[p2data[[1 ;; m]], PlotRange -> {{0, 30}, {-18, 18}}],
{m, 1, Length[pdata], 1}, LocalizeVariables -> False]
But you should be clear that ...
4
Your manipulators don't move because of the lines
(stakeWeights[#] = 100) & /@ allStakes;
(roi[#] = 1) & /@ allStakes;
inside the Manipulate. Just pull those lines outside.
On a related note, I was playing around and found this kind of control that you might benefit/get ideas from:
adaptoControl[Dynamic[settings_]] := Dynamic[
...
3
I am not sure I understand completely what you desire to do - especially the following is not quite clear: when you click on a sphere, how would Manipulate know the depth of the desired point? (due to perspective, this will affect the output)
Then again, Mathematica offers a way to return coordinates with respect to "front and back intercepts with the 3D ...
3
m = {1.5, 3.5, 7, 15, 30, 60, 100, 200, 300, 500, 1000};
(x[#] = 0) & /@ m;
DynamicModule[{stakes = {}}, Column[{TogglerBar[Dynamic[stakes], m],
Dynamic[
Column@{Grid[({#,
Manipulator[Dynamic[x[#]], Appearance -> Labeled],
Dynamic[x[#]]}) & /@ Sort[stakes]],
Dynamic@Total[x /@ m]}]}]]
Edit
Normalized ...
3
There is no need for your data extraction, so I'm not using your pdata = p[[1, 1, 3, 2, 1]], etc.:
Manipulate[ GraphicsRow@{
Plot[x[t] /. sol, {t, 0, m}, PlotRange -> {{0, 30}, {-18, 18}}],
ParametricPlot[{x[t], z[t]} /. sol, {t, 0, m}, PlotRange -> {{-20, 20}, {0, 45}},
PerformanceGoal -> "Quality"]},
...
3
As per the comment:
Manipulate[Plot[Evaluate[FourierSinSeries[x, x, n]], {x, 0, 10}], {n, 1, 10}]
What is happening here is that Plot has the attribute HoldAll so that the FourierSinSeries function has not been evaluated (at the points n) when the plot occurs. There are some examples of this in the documentation for Plot: for instance look at the Neat ...
3
The issue is that by default, whenever a symbol in the Manipulate change value, the Manipulate expression is reevaluated. This means that when data, dollarWon etc. are changed in a given evaluation, their changes trigger another reevaluation and you get an infinite loop.
The way around this is to control the tracked symbols with the TrackedSymbols option.
...
2
How about pulling out the data in the plot and making it into a ListPlot. You can then vary how much of the list you plot but keep the plot range the same.
p = Plot[Sin[x], {x, 0, 10}];
pdata=p[[1, 1, 3, 2, 1]];
Manipulate[ListLinePlot[pdata[[1 ;; m]],PlotRange -> {{0, 10}, {-1, 1}}], {m, 1, Length[pdata],1}]
2
Well, this answer is quite incomplete because I can't fix the problem. I post this answer just to point out that the true reason for the changeless sol is the BCs (D[u[x, y, t], y] /. y -> 0) == mu1[x] and (D[u[x, y, t], y] /. y -> 1) == mu2[x] are largely ignored by NDSolve. If you try:
Clear["`*"]
T0 = 500; a = 0.002; phi[x_, y_] = 300;
(* I ...
2
There are two things about your Manipulate that stand out as possible sources of trouble.
The use of Module to localize variables within a Manipulate isn't a good idea. It is better to introduce an invisible control to create a local variable. Also note that the variable plt isn't needed at all.
For complex computations such as you are carrying out, it is ...
2
I usually prefer Grid over GraphicsGrid and the like:
Manipulate[Grid@{{
ListLinePlot[pdata[[1 ;; m]],
PlotRange -> {{-20, 20}, {0, 45}},
ImageSize -> 300]},
{ListLinePlot[p2data[[1 ;; m]],
PlotRange -> {{0, 30}, {-18, 18}},
ImageSize -> 300]}},
{m, 1, Length[pdata], 1}]
2
You can change the appearance of most controls, but the Manipulator Control has something in it that prevents its dynamic behavior (a bug or a feature ?).
Look (with a slider):
Manipulate[
{Dynamic@a, Plot[Sin[a x + b], {x, 0, 6}]},
{a, 1, 4},
{b, 0, 1, ControlType -> Slider,
Appearance -> Dynamic[If[a > 1, {Tiny}, {Large}]]}]
Now the ...
1
Maybe you can consider a solution like this instead?
newPoint[{col_, Point[pt_]}] := Block[{nc, tr},
{nc, tr} =
(* use RandomChoice to pick an affine transformation and its corresponding color *)
RandomChoice[{{Red, AffineTransform[{{{0.5, 0}, {0, 0.5}}, {0, 0}}]},
{Green, AffineTransform[{{{0.5, 0}, {0, 0.5}}, {1/2, 0}}]},
...
1
Using CompoundExpression (a.k.a ";"), you can include expressions within Manipulate:
Manipulate[
ex99 = a x + b;
Plot[ex99, {x, 0, 1}],
{a, 0, 1},
{b, 0, 1}
]
The semicolon ";" is postfix notation for the CompoundExpression command, which has amongst other things the effect of evaluating the command in the kernel without producing ...
1
Here's one way around it -- make the Manipulator dynamic:
Manipulate[
bAppearance = If[a > 1, "Open", "Closed"];
bEnabled = If[a > 2, False, True];
Plot[Sin[a x + b], {x, 0, 6}],
{a, 1, 4}, {b, 0, 10, Dynamic@Manipulator[##, Appearance -> bAppearance] &}]
The Manipulator is recreated when bAppearance changes. It won't be recreated when b ...
1
Here's one approach, perhaps not as straightforward as might be hoped for but it works:
Manipulate[
Plot[Sin[a x + b], {x, 0, 6}],
{a, 1, 4},
Row@List@With[{choice = Dynamic[If[a < 2, 1, 2]]},
Overlay[{
Control[{b, 0, 1, Appearance -> "Closed"}],
Control[{b, 0, 1, Appearance -> "Open"}]},
{choice}, choice]]]
Also take a ...
1
f[c_, lpd_, SampleSize_] := Probability[x <= c, Distributed[x ,
PoissonDistribution[SampleSize*lpd]]];
Manipulate[Show[
Plot[f[c, lpd, SampleSize], {lpd, 0, .1}, PlotRange -> {0, 1},
Filling -> Axis, Epilog -> Inset[Framed[Style[{point, f[c, point, SampleSize]}, 20],
...
Only top voted, non community-wiki answers of a minimum length are eligible

