Set default options for a function
- To: mathgroup at smc.vnet.net
- Subject: [mg59201] Set default options for a function
- From: Daniele Lupo <danwolf_no_spam_please_ at libero.it>
- Date: Tue, 2 Aug 2005 00:42:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi. I've created (after some effort), a function that plot into a Smith chart a set of data. In this function, all works OK, but I'd like to set default options for MultipleListPlot in a different way. My function in made in this way: MultipleListSmith[lista_List,options___] := Module[{listaUV}, ....I modify listaUV here... MultipleListPlot[listaUV, options] ] now, my data by default is created by four sets of xy data {{data1},{data2},{data3},{data4}}, so I must to do four plots with MultipleListPlot. I't works all (now...), but I'd like to create, by default, four different styles for every plot, in this way: SymbolShape->None, PlotStyle->{{Red},{Blue},{Green},{Orange}}, PlotJoined->True I'd like that these options are used by default, changing them when I need other styles (considering that lista represents four data sets, by default). I've used the default value options___:{PlotJoined -> True, SymbolShape -> None, PlotStyle -> {{Red}, {Blue}, {Green}, {Orange}}} But it does not work, returning the plot with default options, not mine... I've also tried the example shown in the mathematica book of the online help 2.3.10, so, I've written: Options[MultipleListSmith] = {PlotJoined -> True, SymbolShape -> None, PlotStyle -> {{Red}, {Blue}, {Green}, {Orange}}}; MultipleListSmith[lista_List, options___]:= Module[ ..... MultipleListPlot[ listaUV, PlotStyle /. {options} /. Options[MultipleListSmith], PlotJoined /. {options} /. Options[MultipleListSmith], SymbolShape /. {options} /. Options[MultipleListSmith] ] ] but it returns errors to me, of this type: MultipleListPlot::badargs : MultipleListPlot has been given bad arguments. Input Should be data sets consisting of points or points with ErrorBar specifications. If I replace my last three arguments with options, all works fine, but I don't have dafault values that I wants... Anyone can help me? Thanks for your answers Daniele