Prev: Putting controls next to graphics in the Manipulate
Next: A module for some digital image processing-related tasks
From: DrMajorBob on 15 Mar 2010 01:06 Ha! "baroque" sounds so similar to "broke". Bobby On Sun, 14 Mar 2010 05:16:45 -0500, David Park <djmpark(a)comcast.net> wrote: > Why use Manipulate? It's baroque! > > It is so much easier to do a custom dynamic and lay things out just the > way > you want. > > Module[ > {xrange = 1, yrange = 1}, > Grid[ > {{VerticalSlider[Dynamic[yrange], {0.1, 10}, > ImageSize -> {20, 300/GoldenRatio}], > Dynamic(a)Plot[x, {x, 0, 10}, > PlotRange -> {{0, xrange}, {0, yrange}}, > ImagePadding -> {{20, 5}, {20, 5}}, > ImageSize -> 300]}, > {" ", Slider[Dynamic[xrange], {0.1, 10}, ImageSize -> {300, 20}]}}] > ] > > You could also use a Rows and Columns construction. > > David Park > djmpark(a)comcast.net > http://home.comcast.net/~djmpark/ > > > From: Nasser M. Abbasi [mailto:nma(a)12000.org] > > Just a little bit of rambling on Manipulate: > > Currently when writing a Manipulate, the control variables (slides, > buttons, > > etc...) go into one "area" on the Manipulate output "call it the control > variables area", and all the plots and graphics go into another "area" > (call > > it the output area). > > Sometimes, it would be better to position a specific control next to the > plot itself that this control has a relation to. It makes the UI easier > to > work with for the user to work with. > > A simple example, suppose I want to have a 2 slides, one to adjust the > x-scale and the other to adjust the y-scale on a plot. > > I'd like to be to locate the x-scale slider horizontally right there, > below > the x-axis of the plot, and the y-slider vertically aligned next to the > y-axis of the plot, instead as the case now, where the 2 slides will go > to > the "control area", and the plot goes to the Manipulate "output area". > > The above is not an issue if one has one output (one plot or one graphic > object) as the output of the Manipulate, but if there are 3 or 4 plots, > and > then I want to have some controls for one plot and another controls for > another plot, then I'd like to be able to position the controls close to > the > > plot itself that they affect. > > One way to do something close to what I want is shown in the advanced > manipulate documentation, where it talks about > Lissajous figure, and placing dynamics plots on the control area itself. > This way I can have more control of having the control close to the plot. > But the plots are now located on the control area and not in the display > area. > > But I feel there should be a more general approach to this whole issue? > May > be future versions of Manipulate would have something to help with this? > May > > be a GridManipulate[] function? > > --Nasser > > > > > -- DrMajorBob(a)yahoo.com
From: Bob Hanlon on 15 Mar 2010 01:06
Use Grid to approximate what you want. If you want it closer, you can build it up in a Grid with individual uses of Control rather than using Manipulate. f[x_] = (x + 2) (x - 2); Grid[{{Manipulate[ Plot[f[x], {x, -5, 5}, PlotRange -> {-25, 50}, Epilog -> {Red, Line[{{x0, -25}, {x0, 50}}], Line[{{-5, y0}, {5, y0}}]}], {{x0, 0, "x"}, -5, 5, .1, Appearance -> "Labeled"}, {{y0, 0, "y"}, -25, 50, 1, Appearance -> "Labeled", ControlType -> VerticalSlider}, ControlPlacement -> {Bottom, Left}, Paneled -> False], Manipulate[ Plot[f[x], {x, -5, 5}, PlotRange -> {-25, 50}, Epilog -> {Red, Line[{{x0, -25}, {x0, 50}}], Line[{{-5, y0}, {5, y0}}]}], {{x0, 0, "x"}, -5, 5, .1, Appearance -> "Labeled"}, {{y0, 0, "y"}, -25, 50, 1, Appearance -> "Labeled", ControlType -> VerticalSlider}, ControlPlacement -> {Bottom, Left}, Paneled -> False]}, {Manipulate[ Plot[f[x], {x, -5, 5}, PlotRange -> {-25, 50}, Epilog -> {Red, Line[{{x0, -25}, {x0, 50}}], Line[{{-5, y0}, {5, y0}}]}], {{x0, 0, "x"}, -5, 5, .1, Appearance -> "Labeled"}, {{y0, 0, "y"}, -25, 50, 1, Appearance -> "Labeled", ControlType -> VerticalSlider}, ControlPlacement -> {Bottom, Left}, Paneled -> False], Manipulate[ Plot[f[x], {x, -5, 5}, PlotRange -> {-25, 50}, Epilog -> {Red, Line[{{x0, -25}, {x0, 50}}], Line[{{-5, y0}, {5, y0}}]}], {{x0, 0, "x"}, -5, 5, .1, Appearance -> "Labeled"}, {{y0, 0, "y"}, -25, 50, 1, Appearance -> "Labeled", ControlType -> VerticalSlider}, ControlPlacement -> {Bottom, Left}, Paneled -> False]}}] // Panel Bob Hanlon ---- "Nasser M. Abbasi" <nma(a)12000.org> wrote: ============= > > The controls do not all have to be in the same area. > > f[a_, b_, x_] = (x - a) (x - b); > > Manipulate[Plot[f[a, b, x], {x, -5, 5}, > PlotRange -> {-25, 50}, > Epilog -> {Red, > Line[{{x0, -25}, {x0, 50}}], > Line[{{-5, y0}, {5, y0}}]}], > {{a, 2}, -5, 5, .1, > Appearance -> "Labeled"}, > {{b, -2}, -5, 5, .1, > Appearance -> "Labeled"}, > {{x0, 0, "x"}, -5, 5, .1, > Appearance -> "Labeled"}, > {{y0, 0, "y"}, -25, 50, 1, > Appearance -> "Labeled", > ControlType -> VerticalSlider}, > ControlPlacement -> > {Top, Top, Bottom, Left}] > > > Bob Hanlon > Thanks Bob, Yes, one can do that, I know, but that is not what I meant. As I said, when having one plot, i.e. one object, as in your example, then it is not much of an issue. But if one has more than one object being displayed, and some controls are meant to affect one object and others to affect another, then it would be better to be able to locate the controls next to the object. Here is a diagram I just made to help explain what I meant. http://12000.org/tmp/031210_diagram/example.png --Nasser |