Re: Set default options for a function
- To: mathgroup at smc.vnet.net
- Subject: [mg59244] Re: Set default options for a function
- From: LBoogie <lwalker701 at earthlink.net>
- Date: Wed, 3 Aug 2005 01:19:48 -0400 (EDT)
- References: <dcmu2e$gi9$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Daniele Lupo wrote:
> 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
>
Try studying the scheme used in the MultipleListPlot package where the
default options for the colors were assigned to "$$defaultlinestyles".
If you want I can send you my attempt at the SmithChart function. Just
email me your request.
LBoogie