Suitable for ImageSize width in Mathematica

Is there an argument for ImageSize so that Graphics or Manipulate automatically fits the width of the laptop.

+6
source share
3 answers

What about

Plot[Sin[x], {x, -5, 5}, ImageSize -> Full] 

EDIT: or

 Manipulate[ Show[ { Plot[Sin[alpha*x], {x, -5, 5}], Plot[Cos[alpha*x], {x, -5, 5}] }, ImageSize -> Full ], {alpha, 1, 2} ] 
+9
source

For two graphic objects side by side, use the ImageSize parameter for GraphicsRow

 Manipulate[ GraphicsRow[{Show[{Plot[Sin[alpha*x], {x, -5, 5}], Plot[Cos[alpha*x], {x, -5, 5}]}], Show[{Plot[Sin[alpha*x], {x, -5, 5}], Plot[Cos[beta*x], {x, -5, 5}]}]}, ImageSize -> Full], {alpha, 1, 2}, {beta, 1, 2}] 

enter image description here

+5
source

Here is another option besides the Acl solution:

 width := 0.85Cases[NotebookGet[], (WindowSize -> {x_, _}) -> x] Plot[Sin[x], {x, -5, 5}, ImageSize -> {width, Automatic}] 

The disadvantage of this approach is that the space on the left (where you have In[10]:= , etc.) is constant and does not change with the width of the laptop. Thus, the% of the width I used above will vary depending on the width of your laptop. This can be compensated, but I'm not going to do it. However, once you fix your width and find a sweet spot, that should be fine.

This is useful in cases where you need to explicitly specify the sizes / coordinates and not use a feature like Full .

+4
source

Source: https://habr.com/ru/post/901766/


All Articles