function handle=sircolorbar(loc,cmin,cmax) % handle = sircolorbar(loc,min,max) % Display color bar % % loc='vert' appends a vertical color scale to the current % axis. loc='horiz' appends a horizontal color scale. % % loc=H places the colorbar in the axes H. The colorbar will % be horizontal if the axes H width > height (in pixels). % % COLORBAR without arguments either adds a new vertical color scale % or updates an existing colorbar. % % optional cmin,cmax give the labels for the minimum and maximum on scale % % handle = handle to the colorbar axis. % Clay M. Thompson 10-9-92 % Copyright (c) 1984-96 by The MathWorks, Inc. % $Revision: 5.18 $ $Date: 1996/10/22 15:10:46 $ % If called with COLORBAR(H) or for an existing colorbar, don't change % the NextPlot property. changeNextPlot = 1; if nargin<1, loc = 'vert'; end ax = []; t=[1 64]; if nargin >= 1, if ishandle(loc) ax = loc; if ~strcmp(get(ax,'type'),'axes'), error('Requires axes handle.'); end units = get(ax,'units'); set(ax,'units','pixels'); rect = get(ax,'position'); set(ax,'units',units) if rect(3) > rect(4), loc = 'horiz'; else loc = 'vert'; end changeNextPlot = 0; end if nargin > 1 t=[cmin cmax]; end; end h = gca; if nargin==0, % Search for existing colorbar ch = get(gcf,'children'); ax = []; for i=1:length(ch), d = get(ch(i),'userdata'); if prod(size(d))==1 & isequal(d,h), ax = ch(i); pos = get(ch(i),'Position'); if pos(3)0, handle = ax; end