Re: Set default options for a function
- To: mathgroup at smc.vnet.net
- Subject: [mg59252] Re: [mg59201] Set default options for a function
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 3 Aug 2005 01:19:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Daniele, Use... MultipleListSmith[lista_List,options___] := Module[{listaUV}, ....I modify listaUV here... MultipleListPlot[listaUV, options, SymbolShape->None, PlotStyle->{{Red},{Blue},{Green},{Orange}}, PlotJoined->True] ] and pass the plot options in the normal way. That way, any options you pass will be applied first and otherwise the default options will be used. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Daniele Lupo [mailto:danwolf_no_spam_please_ at libero.it] To: mathgroup at smc.vnet.net 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