PRO Smooth_Plot

;+
; NAME
; 	 Smooth_Plot
; PURPOSE
;	Smoothes the plot by a factor given interactively.
;	The factor is the total number of points which will be
; 	involved in the smoothing. This procedure
;	is a part of the mdisp analyser.
;	The operation is performed only on selected plots
; CATEGORY:
;	1D
; CALLING SEQUENCE:
;	Smooth_Plot
; COMMON BLOCK:
;	SmoothRetrieval: for intern use only
; SIDE EFFECTS:
;	The Selectioner of mdisp is used, and a new plot is
;	created.
;	The terminal window is used.
; RESTRICTION:
;	To use ONLY together with the mdisp selectioner
;	procedures.
; -
; MODIFICATION HISTORY
;	Created: June 91, A.Csillaghy


COMMON SmoothRetrieval, smoothNr

IF N_Elements(smoothNr) EQ 0 THEN smoothNr= 0
nbSel = N_Selected()


Clear_Screen
Read,'Please enter the smooth factor: ', factor

FOR i = 1,nbSel DO BEGIN
  name = Selection(i)
  Load_Plot, name, x,y,q
  newY = Smooth( y, factor)
  newName = name + '_sm'+StrTrim(smoothNr,2)
  smoothNr = smoothNr +1 

  Store_Plot, newName, x,newY
  Remove_Sel, name
  Insert_Sel, newName

ENDFOR

END