Re: How to remove an option?
- To: mathgroup at smc.vnet.net
- Subject: [mg9722] Re: [mg9646] How to remove an option?
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Tue, 25 Nov 1997 00:06:17 -0500
- Sender: owner-wri-mathgroup at wolfram.com
"Patrice Trton" <Patrice.Treton at isdnet.net>
[mg9646] How to remove an option?
writes
> How can I remove an option; that is how can I remove it from the
> notebook ?
> I found nothing like DeleteOption or RemoveOption. If there is no
> such function, how can I set an option to the default value?
Patrice,
1) Deleting an option is not advisable: here is an experiment
Unprotect[Plot];
Options[Plot] = DeleteCases[Options[Plot], Frame->_];
Plot[Sin[x],{x,0,2Pi}]
Plot::"opset": "Option \!\(Frame\) is not set in \!\(Options[Plot]\)."
Plot[Sin[x],{x,0,2 \[Pi]}]
Restore the defaults
Options[Plot] = Sort[Append[Options[Plot], Frame -> False]] and we
Protect[Plot]
2) What we can do is
SetOptions[Plot, Frame ->True]
(this will make all subsequent displays from Plot have a frame)
To go back to the default setting we have to use
SetOptions[Plot, Frame ->False]
There is a problem if we can't remember the default setting. To guard
against this we can record the default. Failing this we can quit the
kernel and restart (but this will lose all the definitions made in
the session)
Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/training.html voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester, UK