2

How do I change the default ImageSize for all functions producing graphics programmatically for the current session (only)?

Something close to an answer is given in https://mathematica.stackexchange.com/a/15270/45020, but it either only changes the output of one function (such as Plot) or the solution uses the FrontEnd Menu instead of code.

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
Kvothe
  • 4,419
  • 9
  • 28

1 Answers1

5

You can see how to set frontend options programmatically in the question Is there a way to programmatically set global preferences?.

In your particular case:

SetOptions[
 $FrontEndSession,
 GraphicsBoxOptions -> {"ImageSize" -> 600}
 ]

where 600 is the default image size. This should last only for the current session, you can reset it using this code:

SetOptions[
 $FrontEndSession,
 GraphicsBoxOptions -> {"ImageSize" -> Automatic}
 ]
C. E.
  • 70,533
  • 6
  • 140
  • 264
  • Thanks! Hmm making it last only for the current sessions is kind of important. When sharing the file for example you don't want to mess up someone else's global settings for example. Having to run a specific exit code is bound to fail when someone forgets to close that way. – Kvothe Aug 14 '20 at 11:39
  • @Kvothe I didn't read the post that I linked to carefully enough. It seems like using EvaluationNotebook[] instead of $FrontEnd should limit the effect to the current session. – C. E. Aug 14 '20 at 11:47
  • 1
    $FrontEndSession should affect all notebooks until the frontend is restarted, can't test it at the moment though. – Lukas Lang Aug 14 '20 at 12:13
  • @C.E. Thanks! But now it seems that some settings cannot be changed this way. For example how can I change the LabelStyle using this? The naive attempt LabelStyle -> Red does not work probably for the reasons explained in https://mathematica.stackexchange.com/a/36770/45020. (Ah sorry I see I changed the scope of my question. But still I would be very grateful for something that works for more general options.) – Kvothe Aug 14 '20 at 18:57
  • @LukasLang You are right, it works! I changed the answer to use that. – C. E. Aug 15 '20 at 17:11