
function zi(ax)

%editglob
global CURRX DISP YAXIS PMIN PMAX BMIN BMAX LASTPLOT

if isempty(CURRX)
  error('Must plot a variable first before zooming in')
end

if (nargin < 1)
   if v4,
        disp('Click on upper left and bottom right corners to select region')
        [x y] = ginput(2);
        ax = [x(1) x(2) y(2) y(1)];
   else
      ax = mousebox
   end
end

if length(ax) < 4
  error('Need [xmin xmax ymin ymax] as args]')
end

BMIN = -floor(ax(4));
BMAX = -ceil(ax(3));
ii = BMIN:BMAX; % Assuming negative numbers for bins.
xx = CURRX(ii,:) + DISP(ii,:);
PMIN = min( find( min(xx) >= ax(1) ) );
PMAX = max( find( max(xx) <= ax(2) ) );

eval(LASTPLOT);

%[pmin pmax bmin bmax] = inside1(CURRX+DISP, YAXIS, ax);
%if ~isempty(pmax)
%  PMIN = pmin;
%  PMAX = pmax;
%  BMIN = bmin;
%  BMAX = bmax;
%  eval(LASTPLOT);
%else
%   disp('The "inside1" function failed to find a valid  region.')
%end

