How to "undo" SetOptions (restore defaults)?
I saw this somewhere else on here, but I cannot remember where. The simplest method is to use a fresh kernel:
SetOptions[Plot, Axes -> False];
LaunchKernels[1];
ParallelEvaluate[Options[Plot, Axes]]
(* {{Axes -> True}} *)
then you dispose of the kernel
CloseKernels[]
(* {KernelObject[1, "local", "<defunct>"]} *)
Another option is to use LocalSubmit
. Here's a function to do this:
originalOptions[sym_, option_] := Module[{res},
TaskWait @ LocalSubmit[
Options[sym, option],
HandlerFunctions -> <|"TaskFinished" -> ((res = #["EvaluationResult"])&)|>
];
res
]
Then:
SetOptions[Plot, Axes->False];
originalOptions[Plot, Axes]
{Axes -> True}