function varargout = thermometer(hAx,Trange,Tinit);
% THERMOMETER Turn an axes into a graphical thermometer display
%
%INITIALIZATION: CREATING THE THERMOMETER DISPLAY
% hAx = THERMOMETER(Trange) creates a new figure containing a graphical
% thermometer display. Trange = [Tmin Tmax] specifies the minimum and
% maximum of the temperature scale. Alternatively, Trange = [Tmin Tincr
% Tmax] specifies the scale increment, too.
% hAx is a required output in this case, as it will be passed to all subsequent
% calls to THERMOMETER. Specifically, hAx is the handle to the axis containing
% the thermometer.
%
% THERMOMETER(hAx, Trange) creates a new graphical thermometer display in
% the specified axis, hAx. Trange is as defined above.
%
%UPDATE: Updating the thermometer with a new value.
% THERMOMETER(hAx, T) updates the thermometer display in axis hAx to the
% specified temperature T. hAx was either passed to THERMOMETER during
% initialization, or was returned from the initialization call.
%
% For users who would like more control over the display,
% hPatch = THERMOMETER(hAx,Trange, ...) or hPatch = THERMOMETER(hAx,T, ...)
% returns a handle to the patch object used to represent the thermometer
% value (i.e., the mercury).
%
%
% Examples:
% hAx = thermometer([0 30]); %Create a thermometer in a new figure. Range is 0 to 30 degrees
% thermometer(hAx,15); %Set current temperature to 15 degrees
%
% figure;
% hAx = axes('Position',[.1 .1 .1 .8]);
% hPatch = thermometer(hAx,[0 20 100],40);
% %Create a thermometer on axes hAx. Scale goes from 0 to 100 in steps
% % of 20. Initial value is 40.
% set(hAx,'Box','on'); %Turn the axis box back on.
msg = nargchk(1,3,nargin);
error(msg)
%If first input argument is Trange
if length(hAx)>1
if nargout==0