Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

NB: I've seen other post's that ask similar questions, but I haven't found one whose answers address the problems described here.


The code below is a very artificial example that illustrates the problem.

Manipulate[
 Plot[Cos[k x], {x, 0, 2 Pi}],
 {{k, 0}, -0.00001, 0.00001, Appearance -> "Labeled"}
 , ContentSize -> {300, 200}
 , ControlPlacement -> Left
]

As one moves the slider, the widget's appearance becomes completely unstable: the widget's overall dimensions fluctuate, the relative positioning of its contents also fluctuates, scrollbars pop in and out of existence, etc.

How can this thing be stabilized?


Some important notes:

  • I have expressly placed the controls to the left to bring out the problem with the fluctuating label width. Please take the left-placement of the controls as a given.

  • It's fine with me if the number of digits of precision shown changes as the slider is displaced, as long as this does not result in a horizontal shifting of the plot area. IOW, there should be enough extra space for as many digits of precision may appear.

  • I saw no difference with either PreserveImageOptions->True or PreserveImageOptions->False.

share|improve this question
1  
I think you'll have to be very explicit about controls, e.g. try Labeled[Control[{k, -0.0001, 0.0001}], Pane[Dynamic@k, ImageSize -> 50,ImageSizeAction -> "ShrinkToFit"], Right] in place of {{k,0}....} – N.J.Evans 14 hours ago
    
Not quite what you seek, but this helps: Appearance -> "Open". – David G. Stork 14 hours ago
up vote 3 down vote accepted

This is an alternative:

Manipulate[
    Plot[Cos[k x], {x, 0, 2 Pi}], 
    Row[{"k  ",
         Manipulator[Dynamic[k], {-0.00001, 0.00001}],
         Spacer[10],
         Pane[Dynamic[k], 100]}],
    ContentSize -> {300, 200}, 
    ControlPlacement -> Left]
share|improve this answer

Here is a soltuon inspired by the presentation of Lou D'Andria, Wolfram Technology Conference 2007 (file : ManipulateSecretsRevealed.nb), page 5

Manipulate[
 Plot[Cos[k x], {x, 0, 2 Pi}],
 {{k, 0}, -0.00001, 0.00001,Manipulator[
        Dynamic[Pane[k,100],(k=#)&],#2,
        Appearance -> "Labeled"
        ]&
 }
 , ContentSize -> {300, 200}
 , ControlPlacement -> Left
]
share|improve this answer
2  
The slider does not move when I use this, though the value changes. (Version 11 on Windows) – Simon Woods 11 hours ago
    
I confirm that the slider does not move. I didn't saw this (!). I will try to see if there's a solution tomorrow. – andre 3 hours ago

Another option is to build the Control by yourself and fix the size.

Manipulate[Plot[Cos[k x], {x, 0, 2 Pi}],
 Control[Row[{"k", Slider[Dynamic[k], {-0.00001, 0.00001}], 
    Dynamic[Pane[k, 80]]}, Spacer[5]]],
 ContentSize -> {300, 200},
 ControlPlacement -> Left]
share|improve this answer

You can use the undocumented method option "ControlAreaDisplayFunction"

Manipulate[
 Plot[Cos[k x], {x, 0, 2 Pi}],
 {{k, 0}, -0.00001, 0.00001, Appearance -> "Labeled"}
 , ContentSize -> {300, 200}
 , ControlPlacement -> Left
 , Method -> "ControlAreaDisplayFunction" -> (Pane[#1, 300] &)]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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