idlastro / Math and Statistics: LINEID_PLOT

[Source code]

NAME
LINEID_PLOT
PURPOSE
Plot spectrum with specified line identifications annotated at the
top of the plot.
CALLING SEQUENCE
lineid_plot, wave, flux, wline, text1, [ text2, 
                LCHARSIZE=, LCHARTHICK=, EXTEND =, ...plotting keywords]
INPUTS
wave - wavelength vector for the plot
flux - flux vector
wline - wavelength vector of line identifications.  (only the lines 
        between the plot limits will be used)
text1 - string array of text to be used to annotate each line
text2 - (OPTIONAL) second string array of text to be used for
        line annotation.  Since the text is written with
        proportional spaced characters, TEXT2 can be used if
        you want two sets of annotation to be aligned:
        eg:     Cr IV  1390.009
                Fe V   1390.049
                Ni IV  1390.184
                    instead of
                Cr IV 1390.009
                Fe V 1390.049
                Ni IV 1390.184
OPTIONAL KEYWORD INPUTS
EXTEND - specifies that the annotated lines should have a dotted line 
        extended to the spectrum to indicate the line position.  
        EXTEND can be a scalar (applies to all lines) or a vector with
        a different value for each line.  The value of EXTEND gives 
        the line IDL plot line thickness for the dotted lines.
        If EXTEND is a vector each dotted line can have a different 
        thickness.  A value of 0 indicates that no dotted line is to 
        be drawn. (default = scalar 0)
LCHARSIZE - the character size of the annotation for each line.
        If can be a vector so that different lines are annotated with 
        different size characters.  LCHARSIZE can be used to make 
        stronger lines have a larger annotation. (default = scalar 1.0).
LCHARTHICK = the character thickness of the annotation for each line. 
        It can be a vector so that different lines are annotated with 
        characters of varying thickness.   LCHARTHICK can be used to 
        make stronger lines have a bolder annotation. 
        (default = !p.charthick)
LINEID_PLOT uses the _EXTRA facility to allow the use of any cgPLOT
keywords (e.g. AXISCOLOR, LINESTYLE, CHARSIZE) to be passed to the 
lot.
SIDE EFFECTS
Program uses SET_VIEWPORT to set the !P.POSITION parameter to allow
room for the annotation.   This system variable can be reset to the 
default value by setting !P.POSTION=0 or typing SET_VIEWPORT with no 
parameters
OPERATIONAL NOTES
Once the program has completed, You can use OPLOT to draw additional
plots on the display. 
If your annotated characters are not being rotated properly,
try setting !P.FONT to a non zero value.
EXAMPLE
Annotate some interstellar lines between 1240 and 1270 A.
IDL> w = 1240+ indgen(300)*0.1    ;Make a wavelength vector
IDL> f = randomn(seed,300)        ;Random flux vector
IDL> id = ['N V','Si II','Si II','Si II']   ;Line IDs
IDL> wl = [1242.80,1260.42,1264.74,1265.00] ;Line positions
IDL> lineid_plot,w,f,wl,id,wl,/ext
Note that LINEID_PLOT is smart enough not to overlap the annotation
for the two closely spaced lines at 1264.74 and 1265.00 
HISTORY
version 1  D. Lindler Jan, 1992
Sept 27, 1993  DJL  fixed bug in /extend option
Apr 19, 1994 DJL corrected bug in sorting of charthick (cthick)
Sep 1996, W. Landsman,  added _EXTRA keyword, changed keyword names
        CHARTHICK==>LCHARTHICK, CHARSIZE==>LCHARSIZE
ork with !P.MULTI   W. Landsman   December 2003
se Coyote graphics routines  W. Landsman February 2011