pro WPLSPIKE,base,t,x,First,signaltitle
;+
; NAME:
; 	 WPLSPIKE
;
; PURPOSE:
;	This procedure plots a 1-d signal as baseline with series of spikes.
;
; CATEGORY:
;	Wavelets
;
; CALLING SEQUENCE:
;    WPLSPIKE,base,t,x, signaltitle
;
; INPUTS:
;    base:   number, baseline level
;    t:      ordinate values
;    x:      1-d signal, specifies spike deflections from baseline
;    First:  First time through (will erase data) = 'True' otherwise
;            = 'False' (will use oplot, and keep previous plotted data).
;    signaltitle: title for signal
;
; OUTPUTS:
;    a 1-d signal plot as baseline with series of spikes.
;
; SEE ALSO:
;    wplwcoef, wplpktbl
;
; MODIFICATION HISTORY:
; 	Written by:	Amara Graps		August, 1995
;Translated from MatLab Wavelab routine: plotspikes.m
;-

;Color of text strings
IF !p.background EQ 0 THEN cl = 255 ELSE cl = 0


tt = [[t], [t], [t] ]
b = FLTARR(N_ELEMENTS(x)) + base
xx = [[b],[x+base],[b]]

;Combine columns to make u
ctt = WCOMBINE(tt)
nele = N_ELEMENTS(ctt)
u= FLTARR(1, nele+2)
u(0,1) = ctt
u(0,nele+1) = 1.

;Combine columns to make v
xxt = WCOMBINE(xx)
nele = N_ELEMENTS(xxt)
v = FLTARR(1, nele + 2)
v(0,0) = base
v(0,1) = xxt
v(0,nele+1) = base

;Plot or oplot

CASE First OF
	'True': BEGIN
		IF TOTAL(!p.multi) NE 0 THEN !p.multi(0) = 0
		PLOT, u,v, title = signaltitle, color = cl
		END
	Else: OPLOT, u,v, color = cl
ENDCASE

;
; Algorithm Source:  WaveLab Version 0.600
; WaveLab WWW site: http://playfair.stanford.edu/ 
; WaveLab Questions? e-mail wavelab@playfair.stanford.edu
;   
    
END 
;***************************************************