MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Manipulate Hints, Tips, Tricks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88573] Manipulate Hints, Tips, Tricks
  • From: Frank Iannarilli <frankeye at cox.net>
  • Date: Fri, 9 May 2008 03:21:52 -0400 (EDT)

Hi,

Here's a compilation of beginner-intermediate tips for using
Manipulate toward its max potential - hope it helps.  {I'm on WinXP,
using 6.0.2}

Paste/evaluate the code later below to note the effects of the various
elements:

  1) Style["Text Label", Bold]: User interface annotation labels for
section headings, etc.
  2 Tooltip[]: Note usage for text labels (Style[]) versus for control
labels.
  3) Appearance -> "Labeled":  to get live readout of control
(sliderbar) setting to the right of the control.
  4) ImageSize -> Small:  to play with the item's real estate
allocation in the overall layout
  5) Delimiter:  Horizontal separating bar (nice window dressing)
  6) Row[]: Means of horizontal grouping of elements, e.g., a label
and some dynamically updated value.
  7) Item[]: Wrapper for elements such as Row[], permitting use of the
Alignment option (e.g., Alignment -> Center)
  8) ControlPlacement -> {...}: A rudimentary means to get "wrap-
around" layout of controls around the main plot area.  Note that each
control and annotation declaration (e.g., Row, Item, Style at the
nesting level of the control declarations) counts as one item for
callout of its placement in the {...} list.  Delimiters don't count.
  9) The idiom Style[Manipulate[ ...], DynamicEvaluationTimeout ->
10000] is intended to preclude getting an $Abort in place of the
plots, due to long evaluation time (>5sec), particularly in the
initial building of the interface.



Style[
 Manipulate[
  Plot[a Sin[b x + c], {x, 0, 10}, PlotRange -> {Automatic, {-10,
10}}],
  Style[Tooltip["Vertical Controls", "y-axis"], Bold],
  {{a, 1, Tooltip["amplitude", "signal strength"]}, 0, 10,
      Appearance -> "Labeled", ImageSize -> Small},
  Delimiter,
  Style["Horizontal Controls", Bold],
  {{b, 1, "frequency"}, 0, 10},
  {{c, 0, "time lag"}, -10, 10},
  Item[Row[{Style["Phase (radians): ", Blue],
      Dynamic[Mod[2*Pi*c/b, 2*Pi]]}, Spacer[2]], Alignment ->
Center],
  Item[Row[{Style["Value at x=1: ", Blue], Dynamic[a Sin[b 1. + c]]},
     Spacer[2]], Alignment -> Left],
  ControlPlacement -> {Top, Top, Right, Right, Right, Right, Bottom}
 ],
  DynamicEvaluationTimeout -> 10000]


  • Prev by Date: A Mathematica implementation of SolvOpt
  • Next by Date: RE: Formatting Problem with Summation Symbol
  • Previous by thread: Re: A Mathematica implementation of SolvOpt
  • Next by thread: Display commands in a package