comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: passing multiple keywords to subroutines
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: passing multiple keywords to subroutines [message #14078] Mon, 25 January 1999 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
David Ritscher wrote:
> It's often desirable to redefine a function, and then have this new
> function behave almost like the original function. To cook up an
> example, let's say I need a new plot function, that plots the x-axis
> as .001 units:
>
> pro myplot, x
> plot, findgen(n_elements(x) * 0.001), x
> return
> end
>
> It would now be great to be able to pass any and all possible keywords
> into this new plotting function, so I might call it as:
> myplot, x, title='test', linestyle=3
>
> In IDL, this can be done by including all possible keywords (rather
> tedious!)

It can be done this way, and it is tedious indeed.

Alternatively, you can exploit the keyword inheritance features offered
by the _EXTRA keyword, e.g.

pro myplot, x, _extra = extra_keywords
plot, findgen(n_elements(x) * 0.001), x, _extra = extra_keywords
end

Now all keywords which go unrecognized by your routine MYPLOT are passed
into (but not out of) the PLOT procedure, so that

myplot, x, title='test', linestyle=3

will work the way you intended. In the online help, click the Contents
button, select 'Building IDL Applications', 'Defining Procedures and
Programs', 'Keyword Inheritance'.

Cheers,
Liam.

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
1225 W. Dayton St., Madison WI 53706, USA
Phone (608) 265-5358, Fax (608) 262-5974
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Previous Topic: Wanted: Corrisponding command for seek ( C ) in IDL ???
Next Topic: Re: plot, lons, lats overlayed on a map

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 19:57:05 PDT 2025

Total time taken to generate the page: 1.51461 seconds