Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

This has been explained already in this answer of Mr. Wizardthis answer of Mr. Wizard, so this answer and the whole question should be considered a duplicate.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

This has been explained already in this answer of Mr. Wizard, so this answer and the whole question should be considered a duplicate.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

This has been explained already in this answer of Mr. Wizard, so this answer and the whole question should be considered a duplicate.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

added 290 characters in body
Source Link
Leonid Shifrin
  • 115.8k
  • 16
  • 341
  • 435

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

This has been explained already in this answer of Mr. Wizard, so this answer and the whole question should be considered a duplicate.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

This has been explained already in this answer of Mr. Wizard, so this answer and the whole question should be considered a duplicate.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

Correction per OP's remark
Source Link
Leonid Shifrin
  • 115.8k
  • 16
  • 341
  • 435

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern:

pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code 

where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy.

There might be a downside of this, in case when several sub-functions can take the same subset of options, while you might want to pass some of the options to some sub-functions but not the other - in which case the special "PlotOptions" option, as suggested by rm -rf, might be a better solution. In the simple cases, however, OptionsPattern[{f1,f2,...}] is IMO the way to go.

Source Link
Leonid Shifrin
  • 115.8k
  • 16
  • 341
  • 435
Loading