MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: passing both arbitary and defined options

  • To: mathgroup at
  • Subject: [mg98451] Re: [mg98421] passing both arbitary and defined options
  • From: "David Park" <djmpark at>
  • Date: Fri, 10 Apr 2009 04:52:35 -0400 (EDT)
  • References: <26757789.1239273405870.JavaMail.root@n11>

Something like the following, which I haven't actually tested.

Use a definition:

Options[NewPlot] = Join[Options[ListPlot],{NewPlot -> value}]

Write you NewPlot definition:

{newplotvalue = OptionValue[NewPlot], 
fopts = FilterRules[opts, Options[ListPlot]},
Do something with newplotvalue,
Call ListPlot using fopts

David Park
djmpark at  

From: Eddie [mailto:eddie at] 

So I'm building a plotting function, and I want it to be able to inherit the
same options that a ListPlot[] command can inherit, so my prototype looks
like this:

ListPlot[fancy stuff,options]

Here's the rub, if I additionally want to create a NewPlot-specific option,
it doesn't mesh.  For example:

NewPlot[data_List,OptionsPattern[{newOption->newValue}],options___Rule] :=

Options contains the rule for newOption when NewPlot is called with that
option utilized, and ListPlot throws an error because it's not a recognized
option for ListPlot.

Is there a way I can have my personally declared options and the wildcard
options both present and working?  Is there a way to "Drop" the rule that
matches the user-defined option from 'options'?

  • Prev by Date: Re: Integrate and Piecewise
  • Next by Date: Re: combining contourplot and regionplot [Addendum]
  • Previous by thread: Re: passing both arbitary and defined options
  • Next by thread: exponential moving average with a varying exponents.