4
$\begingroup$

For example:

Manipulate[
 With[{value = a}, 
  Plot[Sin[value x], {x, 0, 10},
       ImageSize -> Small,
       PlotLegends -> "AllExpressions"]
 ],
 {a, 1, 2}, 
 ControlPlacement -> Left]

Below I show two snapshots of the same GUI, for two different positions of the slider:

Mathematica graphics

I have two (simple?) questions regarding this example:

  1. How can I center the slider vertically (while still keeping it to the left of the plot)?

  2. How can I keep the width of the GUI fixed, irrespective of the width of the legend's text (while still keeping the legend to the right of the plot)?

$\endgroup$
  • $\begingroup$ 1. you can put there whatever you want: mathematica.stackexchange.com/q/40752/5478 $\endgroup$ – Kuba Nov 30 '16 at 15:30
  • $\begingroup$ 2. add ContentSize -> 350 as an option to Manipulate. $\endgroup$ – corey979 Nov 30 '16 at 15:44
  • $\begingroup$ You might want to consider a VerticalSlider: {a, 1, 2, 0.01, ControlType -> VerticalSlider, Appearance -> "Labeled"} $\endgroup$ – Bob Hanlon Nov 30 '16 at 17:23
4
$\begingroup$
Manipulate[
  With[{value = a}, 
   Plot[Sin[value x], {x, 0, 10}, ImageSize -> Small, 
    PlotLegends -> "AllExpressions"]], 
  Column[{Control[{{a, 1}, 1, 2, Appearance -> "Labeled"}]}, 
   ItemSize -> {Automatic, 8}],
 ControlPlacement -> Left, ContentSize -> 350]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.