;$Id: color_table.pro,v 1.2 2005/02/09 14:02:26 azuah Exp $
;###############################################################################
; LICENSE:
;  The software in this file is written by an employee of 
;  National Institute of Standards and Technology 
;  as part of the DAVE software project.
;
;  The DAVE software package is not subject to copyright protection
;  and is in the public domain. It should be considered as an
;  experimental neutron scattering data reduction, visualization, and
;  analysis system. As such, the authors assume no responsibility
;  whatsoever for its use, and make no guarantees, expressed or
;  implied, about its quality, reliability, or any other
;  characteristic. The use of certain trade names or commercial
;  products does not imply any endorsement of a particular product,
;  nor does it imply that the named product is necessarily the best
;  product for the stated purpose. We would appreciate acknowledgment
;  if the DAVE software is used of if the code in this file is
;  included in another product.
;
;###############################################################################
;
pro color_table $
	, wID $
	, height = height $
	, width = width $
	, transpose = transpose $
	, CT = CT $
	, low = low $
	, high = high $
	, position = position $
	, range = range $
	, _extra = _extra


	if n_elements( wID ) ne 1 then begin
		window, /free
	endif else begin
		wset, wID
	endelse

	if n_elements( CT ) eq 1 then loadct, CT

	if n_elements( width ) ne 1 then width = 0.1
	if n_elements( height ) ne 1 then height = 0.8
	if n_elements( low ) ne 1 then low = 0
	if n_elements( high ) ne 1 then high = 255

	if n_elements( position ) eq 4 then begin
		width = position[2] - position[0]
		height = position[3] - position[1]
	endif else begin
		position = [ 0., 0., width, height ]
	endelse

	if n_elements( range ) ne 2 then begin
		range = [ 0., 1. ]
	endif


	dev_coord = convert_coord( [ width, height ], /normal, /to_device )
	d_width = dev_coord[0]
	d_height = dev_coord[1]

	xvec = intarr(d_width) + 1
	yvec = indgen(high - low + 1 ) + low
	CT_array = xvec # congrid( yvec, d_height )


	!p.noerase = 1
	tv, CT_array, position[0], position[1], /normal
	plot, [0, 1], range,  /nodata, position = position $
		, xticks = 1, xtickname = [ ' ', ' ' ] $
		, yticks = 1, ytickname = [ ' ', ' ' ] $
		, xminor = 1
	axis, /yaxis

	!p.noerase = 0

end