The following code produces an output of a Plot.


I can then resize the output by grabbing onto one of the corners of the image and dragging.

The following code produces an output of a Manipulate Plot.


I cannot resize the output by grabbing a corner. The image size is fixed. I would like to be able to change it by dragging the corner of the image with the mouse. I realize I can program in the image size in the code above, but for convenience, I would like the ability to resize with the mouse. Ideas?

  • $\begingroup$ this is probably version / OS dependent. You can resize the graphics in Manipulate output in version 9 /Windows10 and version 12/WolframCloud. $\endgroup$ – kglr May 28 '19 at 6:02
  • $\begingroup$ Oh no. I have Mac OS 10.14 running Mathematica 12. Does anyone know a workaround? $\endgroup$ – Michael McCain May 28 '19 at 6:03
  • $\begingroup$ try adding the option PreserveImageOptions -> True or the option Deployed -> False to Manipulate. $\endgroup$ – kglr May 28 '19 at 6:04
  • 2
    $\begingroup$ I’m sorry I misspoke. It does allow you Resize the plot inside the manipulate. However I’m looking to resize the entire image including the outer box that contains the slider. In other words, I want to emulate increasing the magnification of the entire cell. $\endgroup$ – Michael McCain May 28 '19 at 6:08
  • 1
    $\begingroup$ DynamicModule[{sz = {405, 316}}, Pane[Magnify[ Manipulate[Plot[x^a, {x, 0, 3}], {a, 0, 10}], Dynamic[First[sz]/405] ], AppearanceElements -> "ResizeArea", ImageSize -> Dynamic[sz]] ] $\endgroup$ – Szabolcs May 28 '19 at 7:19

Does it fit your needs?

magnifier[expr_] := DynamicModule[{initImageSize, imageSize, mag = 1}
  , initImageSize = imageSize = Rasterize[expr, "RasterSize"]
  ; Pane[
   Magnify[expr, Dynamic@mag],
   AppearanceElements -> "ResizeArea",
   ImageSize -> Dynamic[imageSize, {Automatic, (mag = Mean[imageSize/initImageSize]) &}]

magnifier@Manipulate[Plot[a x, {x, -3, 3}], {a, 0, 10}]
  • $\begingroup$ Yes. Thank you! $\endgroup$ – Michael McCain May 28 '19 at 7:51
  • $\begingroup$ It would be nice to restrict the panel aspect ratio to that of the content. $\endgroup$ – Szabolcs May 28 '19 at 8:03
  • 2
    $\begingroup$ @Szabolcs yes, I also don't like it changes continuously as opposed to on release, will add that later. $\endgroup$ – Kuba May 28 '19 at 10:12

An alternative approach is to control the overall size of Manipulate by resizing the content and resize the control area using Pane with a "ResizeArea" button in the setting for the option "ControlAreaDisplayFunction":

Manipulate[Plot[x Sin [a x + b], {x, 0, 2 Pi}, PlotStyle -> color],
  {a, -1, 1}, {b, {1, 2, 3} Pi/4}, {{color, Red}, ColorSlider}, 
 Method -> {"ControlAreaDisplayFunction" ->
       (Pane[#1,  ImageSize -> Automatic, ImageSizeAction -> "ResizeToFit", 
       AppearanceElements -> {"ResizeArea"}] &)}]

enter image description here

When controls are places in different areas, say with ControlPlacement -> {Top, Left, Bottom}, each control area gets its own "ResizeArea" button:

enter image description here

We can also use Kuba's function magnifier as "ControlAreaDisplayFunction" -> (magnifier[#] &):

enter image description here

  • $\begingroup$ This works in version 9/windows 10. Don't know if it does in other version/os combinations. $\endgroup$ – kglr May 29 '19 at 8:58

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.