Tag Info

Hot answers tagged

11

CurrentValue["ControlsFontFamily"] (* "Segoe UI" on Version 9 / Windows 8 *) (* "Lucida Grande" on OS X 10.6.8 -- thanks: m_goldberg *) (* "Bitstream Vera Sans" on Fedora 20 -- thanks Oska *) CurrentValue["ControlsFontSize"] (* 12 on Version 9 / Windows 8 *) Style[StringJoin[CharacterRange["a", "z"]], FontFamily :> CurrentValue["ControlsFontFamily"], ...


5

You might use Row. For example: Manipulate[{u, v}, Row[{Control[{u, 0, 6}], Control[{v, 10, 20}]}, Spacer[10]]]


5

I do nor know how to implement what you want to do in a Manipulate expression using locators, because I don't know how to handle mouse events in a Manipulate expression. However, if you are willing to accept an answer using EventHandler, the behavior you ask for isn't very difficult to implement. With[{δ = .2}, DynamicModule[{p1 = {0, 0}, p2 = {2, 2}, ...


5

This is what I find more intuitive: circle[] := DynamicModule[{a = {0, 0}, b = {1, 0}, r = 1, w}, { Dynamic@Circle[a, r], Locator[Dynamic[a, {(w = b - a) &, (a = #; b = a + w) &, None}]], Locator[Dynamic[b, (b = #; r = Norm[b - a]) &]] }] Graphics[circle[], Frame -> True, PlotRange -> 2] And this is what fits well ...


5

Perhaps this? Manipulate[ {names, slide, setter, cases}, Dynamic@Switch[cases, "custom", Control[{{names, True}, {True, False}}], "a", Control[{{slide, 0}, 0, 1}], "b", Control[{{setter, "das"}, {"das", "der", "die"}}]], {{cases, "custom"}, {"custom", "a", "b"}}] The variables seem to get localized properly even though the syntax ...


5

I'm adding this answer late because I think it would be good to have an example of OpenerView given as an argument to Manipulate, a common use-case for OpenerView. I also want to point out a special consideration which must be made when specifying controls in such a situation. SeedRandom[3]; With[{nMax = 16, rMax = 12., extent = 300}, With[{redPts = ...


5

For example: Manipulate[ LocatorPane[Dynamic[{x, y}], Graphics[{Red, Disk[]}]], {{x, 0}, InputField}, {{y, 0}, InputField} ]


5

That is how you might do it within the framework of Manipulate: Manipulate[ Plot[a*x^3 + b*x^2 + c*x + d, {x, -4, 4}], Row[{Control[{{a, 1, "a"}, 0, 3}], Spacer[20], Control[{{b, 2, "b"}, 0, 5}]}], Row[{Control[{{c, 1, "c"}, 0, 4}], Spacer[20], Control[{{d, 0, "d"}, 0, 2}]}], ControlPlacement -> {Top, Top, Bottom, Bottom} ] It ...


4

You can try something like: RemoveScheduledTask @ ScheduledTasks[]; RunScheduledTask[c = Round[ControllerState["Y Axis"], .1], .1] Dynamic[{RandomReal[], c}] (*RandomReal tells us when c triggers updating*) Plot[{Sin[x]}, {x, 0, 2}, GridLines -> Dynamic[{{1}, {c}}]] So the Dynamic is not triggered by controller itself but by the value of it. It will ...


3

The problem is, that the Head of series is now Dynamic. With a simple Part you get rid of this: ListPlot[series[[1]], PlotLabel -> title] Besides, why not using Manipulate? Your problem seem perfectly suited for this: Manipulate[ forest = Range[30]; energy = Reverse[Range[30]]; Switch[choice , 1, series = forest; title = "Tree Growth" , 2, ...


3

Edited I don't like this much because what I take are intended to be the osculating circles don't have a radius equal to the radius of curvature. I used your formula, but it appears to be wrong. Nevertheless, what I've worked out does install a popup menu into a Manipulate expression which will select which parametric function will be displayed. It will ...


3

You could label the points: Manipulate[ Column[{Dynamic@ Grid@Map[Pane[#, {60, 20}] &, Transpose@points, {2}]}], {{points, ({#, 0.1} &) /@ {-1, -1.5, 1.5, 1}}, LocatorPane[ Dynamic[points, (points = {#, 0.1} & /@ First /@ #) &], Graphics[{}, PlotRange -> {{-2, 2}, {-.5, .5}}, AxesOrigin -> {0, 0}, Axes ...


2

I had to struggle with similar things before, and I found that the best way to control location of controls with respect to output they affect is to discard the whole Manipulate display area and do everything in the control area itself using Dynamics. This way you can control exactly where each slider/controller is located. This is done using basic Grid ...


2

I think you just have to experiment with adjusting the Sine plot. Here is what I got by doing a little trial and error work. Manipulate[Plot[a b c x, {x, 0, 100}, PlotRange -> {0, 100}], {{a, 1}, 0, 2, Appearance -> "Labeled"}, {{b1, 1}, 0, 2, Appearance -> "Labeled"}, {{b2, 1}, 0, 2, Appearance -> "Labeled"}, Dynamic[Plot[Sin[t], {t, 0, ...


2

I don't understand why, but If I put the ExcelLink Function outside of PopupMenu, the problem goes away, as seen below:


2

You can place any controls inside an OpenerView: OpenerView[{"ButtonGroup", Column[{ Button["P5", Print[5!]], Button["P7", Print[7!]] }] }] Instead of OpenerView you could also use TabView or SlideView. I use this quite often to group, hide and open controls within a complex Manipulate. Keeps the screen clean.


2

Try this: OpenerView[{"", Column[{a^2 + b^2, Plot[Sin[x], {x, 0, 2 \[Pi]}], Speak["This is the opener view"]}]}]


2

Personally, I would stay with your first example, but if you insist on a more loose coupling between the button and the Export expression, maybe something like the following: filePath = FileNameJoin[{HomeDirectory[], "DeskTop", "test.jpg"}]; Manipulate[ p = Plot[Sin[x - n], {x, 0, 4 Pi}, ImageSize -> 300]; If[export, Export[filePath, p]; export = ...


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}] ]


1

Here's an idea: update[p_, pi_, i_] := ReplacePart[p (1 - pi)/Total[Drop[p, {i}]], i -> pi]; Manipulate[ p, {{n, 3}, Slider[Dynamic[n, (n = #; p = ConstantArray[1./n, n]) &], {2, 10, 1}] &}, {{p, ConstantArray[1./3, 3]}, ControlType -> None}, Control[ {{p, ConstantArray[1./3, 3]}, Dynamic[ Column @ Table[With[{i = i}, ...


1

But I need to also have it expandable so that I could view and enter the numeric value Maybe I am missing something, but why use ControlType for? Is this what you mean? Manipulate[ Plot[Sin[a x], {x, -3, 3}, ImageSize -> 600, AspectRatio -> 0.2], {a, -10, 10, Appearance -> "Labeled", ImageSize -> 600} ]


1

I don't know how to fix it, but the issue seems to be with wrapping Dynamic around any kind of CurrentValue information: u = 0; Dynamic[Refresh[u++, TrackedSymbols :> {}, UpdateInterval -> 1]] (* Correctly updates: 1....2....3.. *) Dynamic[Refresh[ControllerState[4, "X1"], TrackedSymbols :> {}, UpdateInterval -> 1]] Dynamic[ControllerState[4, ...


1

Generally, Dynamic is used in two ways: Re-evaluating expressions when they would change, and displaying the result. The syntax is Dynamic[expr]. Dynamic[expr] cannot be used to represent the value of expr in different context and calculate with it. It is only used to display it. Allowing controls to change values of variables. Typical syntax: ...


1

It looks to me like "Lucida Sans Unicode" on Windows or "Lucida Grande" on OSX. But it's hard to be sure. It'll render differently on Windows and OSX (and AFAIK also differently on older versions of Windows). I'm guessing your screenshot is from Windows, since the kerning is closer to that used by "Lucida Sans Unicode".


1

One can slightly rewrite your code and obtain a nice Manipulate f[x_, a_, μ_, σ_] := a Exp[-(x - μ)^2/(2 σ^2)]/(Sqrt[2 π] σ) n = 3; vars = Through@{a, μ, σ}@# & /@ Range[n]; func = f[x, ##] & @@@ test; values = {{50, 5, 20}, {50, 50, 40}, {100, 80, 20}}; rangelow = 0.7 values; rangehigh = 1.3 values; With[{func = func}, Manipulate[Plot[func, ...


1

x = {3, 3}; y = {5, 3}; LocatorPane[Dynamic[{x, y}], Dynamic@Graphics[{{Gray, Circle[x, Abs[y[[1]] - x[[1]]]]}, {Blue, PointSize[0.02], Point[{x, {y[[1]], x[[2]]}}]}}, Axes -> True, PlotRange -> {{-2, 8}, {-2, 8}}, AxesOrigin -> {0, 0}], Appearance -> None]


1

I believe the jump in value of asd happens because you're dragging the indicator with the mouse when the range is reset. Here is a way that does what you want, I think. It interrupts the mouse-dragging by creating a new Slider when the boundary is reached. {Dynamic@asd, Dynamic@Slider[Dynamic[asd], Which[asd < 10, {1, 10}, asd >= 10, {9, 50, ...


1

Initialization for CheckboxBar works pretty much as for any type of control. {{checkBoxes, initial-checked-values, ""}, value-list, ControlType -> CheckboxBar}] For example, Manipulate[Row[{"Boxes checked: ", Length@checkBoxes}], {{checkBoxes, {1, 3}, ""}, {1, 2, 3, 4}, ControlType -> CheckboxBar}] will produce the following initial state when ...


1

I have a way of doing this by wrapping the label with a Panel. This has two effects: organizes space making a view more accurate and prevents jerking. Since you gave no code that can be played with, only the controls, I make here a simple example with two controls, just to demonstrate the way. Here you are: Manipulate[ Plot[Sin[\[Theta]*x], {x, 0, 2 ...


1

I downloaded and examined the CDF you refer to. I conclude from my examination that what looks like a highly stylized TabView may actually be a custom control built based on EvenHandler. Often when one sees what look like fancy versions of Mathematica controls in sophisticated CDFs, they are custom replacements such as the one you were looking at. As far as ...



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