11

Update 2: A variation on RobertNovak`s answer to keep the horizontal axis of the second locator fixed: tF[p : {{x1_, y1_}, {x2_, y2_}}] := If[#[[1, 1]] != #[[2, 1]], If[CurrentValue["CurrentLocatorPaneThumb"] == 2, #, {#[[1]], {x2, #[[1, 2]] + (x2 - #[[1, 1]]) (y1 - y2)/(x1 - x2)}}], p] &; Manipulate[Graphics[{InfiniteLine @ pt, ...


7

To make Manipulate, follows these steps. Decided which variables should be controlled. Make slides/menus/etc.. for each control variable. Write the Manipulate expression which access these variables. Add TrackedSymbols :> {...} and list the names of these control variables to help Manipulate know which to track when changed. The structure is like this ...


6

1. Replace your second SetterBar with a row of individual setters and link Enabled option value for the third setter to the value of Clo: DynamicModule[{Clo = 1, Cp = 0, Cprj = 0}, Column[{Column[{Style["Location of C", FontSize -> 14], SetterBar[Dynamic[Clo], {0 -> "Origin", 1 -> "Tip of B"}]}, Alignment ...


5

I have not been able to found any in-built way to lock the rotation of 3D graphics around one axis, so we will have to build our own solution. Let's use EventHandler to catch the movements of mouse, and then dynamically change the point of view via ViewVector and ViewVertical. We will use the natural tilt of the Earth, i.e. $23.4^\circ$. To make the rotation ...


4

There's no reason to use DynamicModule here, really. The following will work: ClearAll[manipulatePlot] SetAttributes[manipulatePlot, HoldAll]; manipulatePlot[expr_, plotSpec_, manipSpec_] := Manipulate[ Plot[expr, plotSpec], manipSpec ]; g[x_, a_] := a x^2 manipulatePlot[g[x, a], {x, 0, 2}, {a, 0, 2}] You need to hold the arguments to prevent ...


3

One possibility is to make a slider for z ClearAll[f, g, h, x, y, z]; f[x_, y_] := -(-3 + x)^2 Cos[(2/3 + x) (Pi - y)] + 5 (1 + x)^2 Cos[(2/3 - x)] Sin[Pi (2/3 + x)]; g[x_, y_] := -(3 + x)^2 Sin[Pi (2/3 + x)] Sin[(2/3 - x)] + 5*(-1 + x)^2 Sin[(2/3 + x) (Pi - y)]; h[x_, y_, z_] := 4 *(-4 + x)^2 Cos[1/6 (Pi - 6 x z)] - (-4 + x^2)^2 (Sin[x (2 Pi - z)] + 2 Cos[2 ...


3

As noted in the comments, this is a bug in Mathematica 12.3. To fix it, evaluate the following: Once[ prot = Unprotect@ArrayPlot; DownValues@ArrayPlot = DownValues@ArrayPlot /. expr : HoldPattern@Catch@_[md_, ___] :> Module[{md}, expr]; Protect /@ prot; ] Now, your code should work as expected.


3

Why Trackedsymobls behaves so strange is often a mystery, and only developers from Wolfram Research can give all reasons. However, you have more control over TrackedSymbols if used in Dynamic: (*Colorfunction*)cf[z_]:=RGBColor[z,1-z,0]; (*BarLegend 1*) f1[x_]:=BarLegend[{"Rainbow",{0,1}}] (*Barlegend 2*) f2[x_]:=BarLegend[{cf[#]&,{0,0.5}}] ...


3

Finaly thanks to @kglr the locators move in the most intuitive way. The second point now only moves in y while the first one is draged arround. Manipulate[Graphics[{InfiniteLine@pt}, PlotRange -> 2], {{pt, {{-1, 0}, {1, 1/2}}}, Locator, TrackingFunction -> (With[{t = Apply[Divide]@Reverse[pt[[2]] - pt[[1]]]}, pt = If[#[[2, 1]] != #[[...


2

Another approach using DynamicModule: mPlot =. mPlot[func_, r1_, r2_] := DynamicModule[{a }, Column[{ Slider[Dynamic[a], r2], Dynamic@a, Dynamic[Plot[func[a, x], {x, First@r1, Last@r1}]]}]] Since Manipulate generates a DynamicModule, there is no reason to wrap the two as you have originally tried.


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