Re: Set default options for a function
- To: mathgroup at smc.vnet.net
- Subject: [mg59230] Re: Set default options for a function
- From: albert <awnl at arcor.de>
- Date: Wed, 3 Aug 2005 01:19:38 -0400 (EDT)
- References: <dcmu2e$gi9$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Daniele, your second approach ist the way to go: > Options[MultipleListSmith] = {PlotJoined -> True, SymbolShape -> None, > PlotStyle -> {{Red}, {Blue}, {Green}, {Orange}}}; specifiying the options to be options helps mathematica to separate "arguments" from "options": MultipleListSmith[lista_List, options___?OptionQ]:= ... also you need MultipleListPlot Options of the form name->value, so the following should work (i have introduced another variable to avoid redundancy): MultipleListSmith[lista_List, options___?OptionQ]:= Module[{ allopts=Flatten[{options,Options[MultipleListSmith]], ... }, ..... MultipleListPlot[ listaUV, PlotStyle -> (PlotStyle /. allopts), PlotJoined -> (PlotJoined /. allopts), SymbolShape -> (SymbolShape /. allopts), ] ] you also might want to look at the function FilterOptions in the package Utilities`FilterOptions` which will be handy if you want to pass even more options to MultipleListPlot, the following lets you pass every option to MultipleListPlot, and it even saves you typing: Needs["Utiltities`FilterOptions`"]; MultipleListSmith[lista_List, options___?OptionQ]:= Module[{ allopts=Flatten[{options,Options[MultipleListSmith]], ... }, ..... MultipleListPlot[ listaUV, FilterOptions[MultipleListPlot,allopts] ] ]