Tag Info

Hot answers tagged

10

I have not fully diagnosed the problem, but it appears as if vv and vp are not initialized when you effectively wrap a Dyanmic module within a dynamic module (which is what you've done with the Manipulate. Changing your DynamicModule into the Manipulate seems to get the result you desire if you Initialize vv and vp: Clear[vv, vp] Manipulate[ With[{img1 = ...


10

I use something similar to @Sjoerd's suggestion with OpenerView. Here is the essence: ClearAll[Inspect] Inspect[x_] := inspect2[x] ClearAll[inspect2] SetAttributes[inspect2, HoldAll] inspect2[x:_[a__]] := OpenerView @ {inspectView[x] // Framed, Dynamic @ Column[List @@ inspect2 /@ Hold[a]]} inspect2[x_] := inspectView[x] SetAttributes[inspectView, ...


9

Try OpenerView[{Head[#], args @@ #} ] & //@ g [For this demonstration I opened a few of the OpenerView-s. There are many more to explore.]


7

Analysis Let's get Manipulate and Plot out of the picture so that we do not complicate things. All we need to know and consider is that Manipulate scopes its variables in a manner similar to Module. Now observe: Module[{a, b}, holdedf = a*x + b // HoldForm; Row @ {"Linear function", holdedf} ] Linear functiona$7986 x+b$7986 The Symbols a and b ...


6

The faster/slower controls can be controlled using AppearanceElements. The following values can be used in Manipulate: "StepLeftButton", "StepRightButton", "PlayPauseButton", "FasterSlowerButtons", "DirectionButton" Take the ones you want to use (you wanted to drop "FasterSlowerButtons"): Manipulate[ Graphics3D[{Hue[.12], {Sphere[{0, 0, 0}, .1]}, ...


5

I won't catch the fish for you rather than teach you how to do it. Generate a random data set: data = LowpassFilter[Accumulate@Re@Fourier[Table[RandomReal[{-.5, .5}] Sinh[Exp[RandomReal[{-.5, .5}]^2]], {2^10}]], .4]; and transform it dwd = DiscreteWaveletTransform[data, HaarWavelet[]] swd = StationaryWaveletTransform[data, ...


4

The default Manipulator, FEPrivate`FrontEndResource["FEExpressions", "Manipulator04"], does not allow the option AnimationRepetitions to be passed to the Animator used by the Manipulator. However, there is another FEPrivate`FrontEndResource["FEExpressions", "Manipulator05"], that does allows further options to be passed. See ...


4

Change the AnimationRate in the iterator: Manipulate[ Graphics3D[{Hue[.12], {Sphere[{0, 0, 0}, .1]}, {FaceForm[], Sphere[{0, 0, 0}, .8 + .02]}, Gray, Table[Line[ Table[{.8}[[i]] {Cos[tt], Sin[tt], 0}, {tt, 0, 2 Pi, 2 Pi/100.}]], {i, 1}], Blue, Sphere[.8 {Cos[t], Sin[t], 0}, .02]}, PlotRange -> All, ImageSize -> {400, ...


4

ListPlot accepts data sets with wrappers such as Tooltip, Labeled, ... , Button etc. (See this answer on various wrappers you can use with ListPlot.) Assuming that the label you want to attach to a point in dataPoints is the country label in the same position in countries, you can pre-process dataPoints and countries using Labeled to produce a labeled data ...


3

Try to use RegionFunction in Plot3D instead of RegionPlot3D, like this Manipulate[ Plot3D[1 - x - y, {x, 0, 1}, {y, 0, 1}, RegionFunction -> Function[{x, y, z}, x >= 0 && y >= 0 && z >= 0 && y <= 1 - alfa && z <= 1 - alfa], PlotPoints -> 40, PerformanceGoal -> Quantity, PlotRange ...


3

You can set up list of opacities automatically data = {{1, 2, 3}, {2, 5}, {0, 6}}; Manipulate[ListPlot[data, Joined -> True, PlotRange -> {-1, 5}, PlotStyle -> (Opacity@Boole@MemberQ[x, #] & /@ Range@Length@data)], {{x, {1}}, Dynamic@Range@Length@data, ControlType -> TogglerBar}]


3

data = {{1, 2, 3}, {2, 5}, {0, 6}}; Manipulate[ ListPlot[data[[x]], Joined -> True, PlotRange -> {-1, 5}], {{x, {1}}, Range@Length@data, ControlType -> TogglerBar} ] With more togglers toggled: With differently size data data = {{1, 2, 3}, {2, 5}}; Manipulate[ ListPlot[data[[x]], Joined -> True, PlotRange -> {-1, 5}], {{x, {1}}, ...


3

I would work with nested With: With[{f := 1-2+a x + b}, With[{stringf = ToString[HoldForm[f], TraditionalForm]}, Manipulate[ Plot[f, {x, -10, 10}, PlotRange -> {{-10, 10}, {-10, 10}}, PlotLabel -> "Linear function " <> stringf], {{a, 1}, -5, 5}, {{b, 0}, -5, 5}, TrackedSymbols :> {a, b}]]] which gives (now properly held and ...


2

Something like this?: data = {1, 1, 2, 2}; DynamicModule[{max = Tr @ data, x}, Manipulate[ Normal @ SparseArray[Thread[x -> 1], max], ## ] & @@ Thread[{x, Internal`PartitionRagged[Range@max, data], ControlType -> TogglerBar}] ]


2

It is easy to make a Play button to make it play once. Does it have to use the Mathematica build in play button? Here is an example: (if this is not what you meant, please provide more information) Manipulate[ tick; If[f < maxFrequency, tick = Not[tick]; f += 0.01]; Plot[Sin[2 Pi f t], {t, -10, 10}], {{maxFrequency, 1, "max frequencey? (Hz)"}, ...


2

Manipulate updates each time its expression changes. The expression is a function of the control variables. Or if the expression contains a symbol or expression that appears only inside the Manipulate expression (i.e. not global before), even though it is not control variable, and this symbol/expression gets updated during evaluation of the manipulate ...


2

You can either specify the control type as Setter: smax = Pi; superset = {{.2, 3}, {.3, 4}, {.5, 6}}; Manipulate[Module[{SI, PH, R, TH, Z, MER, si, ph, r, th, z, mer, b, smax}, {b, smax} = subset; {si[t_], ph[t_], r[t_], th[t_], z[t_], mer[t_]} = {SI[t], PH[t], R[t], TH[t], Z[t], MER[t]} /. Quiet@First@ NDSolve[{SI'[s] == 1/b + Sin[PH[s]] ...


2

Your code defines the Control to be a Slider by default. Typing into a different device, the InputField, yields a separate computation and separate output cell. If you'd like to change the Control for input to be an InputField so you can type different values of a without producing different output cells, try this: Manipulate[Plot[Sin[a x], {x, 0, 2}], ...


2

Here is my try using MapIndexed, Mouseover, and Tooltip. The idea is to highlight parts of an expression as the mouse is over it and to display at the same time the exact level indices corresponding to it. Here is a simple example to understand the core idea : myExpr = {{1, 2, {11, 22}}, {3, 4, {111, {222}}}}; and level = 3; (* For example all parts at ...


2

To have no control for seed to appear, apply the option ControlType -> None to the variable: Manipulate[ SeedRandom[seed]; ArrayPlot[CellularAutomaton[110, RandomInteger[1, 600], 700]], {seed, 1, 1000, 1, ControlType -> None}, Button["Randomize initial condition", If [seed < 1000, seed = seed + 1, seed = seed - 1]]]


2

Everywhere wrapping pt in Dynamic allows it to be updated without triggering changes in the CountourPlot, which is independent of pt: Manipulate[Module[{}, p1 = ContourPlot[expr /. {x -> x, y -> y}, {x, -5, 5}, {y, -5, 5}, Contours -> 20]; grad = D[expr, {{x, y}}]; ngrad = grad /. {x -> Dynamic[pt[[1]]], y -> Dynamic[pt[[2]]]}; p2 = ...


2

Here's another workaround: Use Show to wrap the Image3D with Graphics3D. This changes how the graphics are processed by the Front End (I suspect). Evidently the FE is grabbing the graphics parameters such as the view point, and dealing with it. I don't know enough to give a complete explanation. Certain things are optimized, such as using the GPU ...


1

My feeling is that this question is probably too broad and a definitive answer might be too long or nearly impossible. This a comment to point out issues to consider in deciding whether and how to localize symbols. + Is the application self-contained? Or does it consist of several components that need access to a shared variable (e.g. a database or ...


1

I think the problem may be that you are trying to plot a region that is too thin (using the equality in the final condition). Allow the 3D region to have some small finite thickness and it seems to plot OK: alfa = 0.25; RegionPlot3D[x >= 0 && y >= 0 && z >= 0 && y <= 1 - alfa && z <= 1 - alfa && ...



Only top voted, non community-wiki answers of a minimum length are eligible