% display an ``xy'' image
%
% Use: tvxy(Axy)
%      tvxy(Axy,.5)  % displays on a half-pixel grid

function returnnothing(xyz,pelsize)

[M,N]=size(xyz);
if (N>3)|(N<2)
  error('tvxy: ``xy'''' matrix must be 2 wide (complex) or 3 wide (real)')
end%if

if N==2
  x=real(xyz(:,1));
  y=imag(xyz(:,1));
  z=xyz(:,2);
end%if

if N==3
  x=xyz(:,1);
  y=xyz(:,2);
  z=xyz(:,3);
end%if

if nargin==1   % default to single pixel grid
  pelsize=1;
end%if

xmin=min(x);
xmax=max(x);
ymin=min(y);
ymax=max(y);

[wanted_n,wanted_m]=meshgrid(ymin:pelsize:ymax,xmin:pelsize:xmax);
[M,N]=size(wanted_m);
u=reshape(wanted_m,M*N,1);
v=reshape(wanted_n,M*N,1);

w=nn([x,y,z],[u,v]);
W=reshape(w,M,N);

% there is no NaN in ``xy'' images, so we set map gray
colormap(gray(64))
imagesc(ymin:pelsize:ymax,xmin:pelsize:xmax,W)
axis('image')

