

pro demo,ps=ps

   ; demonstration of color intensity use

   ; create bogus data array
   a = dist(40,40)

   ; create shading array
   b = findgen(40) # (fltarr(40)+1)
  

   ; open device (if /ps, produce postscript file)
   open_device,ps=ps,filename='idl.ps',/color

   if (!d.name ne 'PS') then erase
   myct          ; load color table and set lowest colors for line plots

   ; load color table EOS-B into 16 fields beginning from 20
   loadct,27,bottom=20,ncolors=16

   ; retrieve color vectors and blow them up to 160 elements
   tvlct,rcol,gcol,bcol,/get
   ; delete first 20 entries (those are used for line graph colors)
   rcol = rcol(20:35)   ; 16 elements remaining
   gcol = gcol(20:35)
   bcol = bcol(20:35)

   rnew = fltarr(160)
   gnew = rnew
   bnew = rnew
   for i=0,15 do begin
      rnew(10*i:10*i+9) = rcol(i) 
      gnew(10*i:10*i+9) = gcol(i) 
      bnew(10*i:10*i+9) = bcol(i) 
   endfor

   ; "fade" offset colors
   ; this is done by increasing the color values of r, g, and b
   ; proportionally
   ; note that we scale all 16 colors at once
   dum = indgen(16)
   for i=0,9 do begin
      tmp = (255.-rnew(dum*10+i))/10.
      rnew(dum*10+i) = rnew(dum*10+i) + fix(tmp*i) < 255
      tmp = (255.-gnew(dum*10+i))/10.
      gnew(dum*10+i) = gnew(dum*10+i) + fix(tmp*i) < 255
      tmp = (255.-bnew(dum*10+i))/10.
      bnew(dum*10+i) = bnew(dum*10+i) + fix(tmp*i) < 255
   endfor

   ; put those vectors into color table beginning on entry 20
   tvlct,rnew,gnew,bnew,20


   ; now generate pseudo data that corresponds to color entries
   ; from arrays a and b
   ; first bytscl the values of a to range from 0 to 150
   ; blow array up to 400x400 for display, use interpolation
   c = bytscl(congrid(a,400,400,/interp),top=15)*10

   ; now add values of b, reduced to the range from 0 to 9
   cb = bytscl(congrid(b,400,400,/interp),top=9)

   cdisp = c + cb

   ; use the c array as an image and display it
;  tv,cdisp+20

   p = [ 0.1, 0.1, 0.9, 0.9 ]
   TVimage,cdisp+20,position=p,/keep_aspect
   ; better to use TVImage routine from D. Fanning, because that allows
   ; same output in ps file and overlaying of line graphs


   ; dummy overlay of some contour lines from original A array
   !p.position = p   ; returned from TVimage

   contour,a,level=findgen(10)*3,color=1,/noerase  




   close_device

return
end


