Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

I am facing a problem in adding a label to a PopupMenu. I have two plots a and b of same size. But when I am adding label to them in PopupMenu, it is changing the size of the plot.

When the Label size is bigger, it compresses the plot so that it adjust to the FieldSize of PopupMenu. But I dont want this.

 a = Manipulate[
       l = DiscretePlot[Cos[a t], {t, 0, 2 Pi, Pi/6}, ExtentSize -> Full, 
       ImageSize -> Scaled[1], AspectRatio -> .25, ImageMargins -> 0, 
       ImagePadding -> 0], 
       Mouseover["vertical", Control[{{a, 1, "a Manipulator"}, 1, 20}]], 
       ControlPlacement -> Bottom];
b = Manipulate[q = Graphics[
     DiscretePlot[Sin[g t], {t, 0, 2 Pi, Pi/6}, ExtentSize -> Full, 
     PlotStyle -> Orange, AspectRatio -> .25, ImageSize -> Scaled[1], 
     ImageMargins -> 0, ImagePadding -> 0]], {g, 1, 10}];

        Dynamic[p], {a ->Labeled[l, (Framed["pop_up_window Plot"]), {Right}, 
                   LabelStyle -> Directive[Bold, FontFamily -> "Helvetica"]], 
                 b -> Labeled[q, (Framed["mouseover Plot"]), {Right}, 
               LabelStyle -> Directive[Bold, FontFamily -> "Helvetica"]]}, 
       FieldSize -> {24, 8}, ImageMargins -> 0, 
       FrameMargins -> 0, ContentPadding -> False, 
       Alignment -> {Center, Center}]}, {Dynamic[p]}}, Spacings -> 20, 
       Alignment -> {Left, Top}]

enter image description here

When I am adding label, then the first plot becomes smaller than the second. I want that Label size should not affect the Plotsize.

share|improve this question
Could you add an image of what you're seeing, and what you want to see? – Mr.Wizard Jul 18 '12 at 8:05
I am unable to reproduce the behaviour you describe. The plots always have the same size here. Can you avoid using Scaled units in FieldSize? I'm not sure if you're aware that Scaled is relative to the notebook width in this case. Probably this is why I can't reproduce it on a different system. – Szabolcs Jul 18 '12 at 8:19
@Szabolcs: I have edited FieldSize in code. I was not knowing by Scaled, it will not work on different systems – Jennifer Jul 18 '12 at 8:29
I still can't reproduce it on my system, Jennifer. This is what I get using your code: The plots are the same size. The labels do get compressed. – Szabolcs Jul 18 '12 at 8:29
@Ajasja: Yes, so how can I rectify this? – Jennifer Jul 18 '12 at 9:13
up vote 3 down vote accepted

I am unable to reproduce this behaviour on my system. The plots always have exactly the same size. This is what your code produces here:

But on your system you could try setting the image size explicitly to force a fixed size. Inside Labeled, try replacing q by Show[q, ImageSize -> 100]. Do the same for l. Does this fix the problem?

share|improve this answer
Thanks, it works. – Jennifer Jul 18 '12 at 9:28
One more thing how can I set first plot as default? – Jennifer Jul 18 '12 at 12:05
@Jennifer To have a default value, you can set a value to p before evaluating the PopupMenu. This will be the initial value. It has to match one of the values that the PopupMenu can set to p. – Szabolcs Jul 18 '12 at 16:44
I have tried that too but when I am deploying it in CDF, it is showing p as the output. I want that when I dont select any plot on the popupmenu, then too it should select some plot. – Jennifer Jul 18 '12 at 18:55

Your Answer


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.