; to make a nice multicolored plot out of the fitted line shapes
;
; see also : show_fit SHOW LINEFIT

refmacro 0
if ($dim==1) then
   if ($disp1d==0) error '*** Display should be on'
   if ($npk1d==0) error '*** Peak table should not be empty'
   set shf_l = $npk1d
elsif ($dim==2) then
   if ($cdisp2d==0) error '*** Contour display should be on'
   if ($npk2d==0) error '*** Peak table should not be empty'
   set shf_l = $npk2d
else
   error '*** Not implemented yet'
endif
set shf_file = '/tmp/pk_shf'
sh ('rm -f '//$shf_file)   pkwrite $shf_file
set i = 1
; first whole spectrum
pen 5 *pl plot *pl
put data
set ech = $absmax
pen 7 *pl get linefit absmax $ech plot *pl
; then each line
pen 1 *pl
set p = 1
=loop
  pkread $shf_file yes pkselect $i $i 0
  get linefit  absmax $ech
  set p = (%+1)  if ($p>4) set p = 1
  pen $p *pl plot *pl
  set i = (%+1) if ($i<=$shf_l) goto loop
pkread $shf_file yes
sh ('rm '//$shf_file)
get data

