
ncol=64;
pause on;
clg;
subplot(111);

disp(' ')
disp('  ----------------------- ')
disp(' ')
disp('  Basic snaphot plotting ')
disp(' ')
disp('  ----------------------- ')
disp(' ')
disp(' ')
disp('  Warning ! ')
disp('  the snapshots may be slightly ')
disp('  distorted near the boundaries ')
disp('  because of the irregular grid ')
disp('  spacing ...')
disp(' ')

nx=input(' Give nx (nx+1, nx from FD sim.) ');
nz=input(' Give nz (nz+1, nz from FD sim.) ');
dir
files=input(' Give name of snaphot file (in single quotes) ');
disp(' Loading snaphot files ');
eval(['load -ascii ' files]);
snap=eval([files]);
ns=floor(length(snap)/(nx*nz));

file=input(' Give file with x coordinates  ');
eval(['load -ascii ' file]);
x=eval([file]);
file=input(' Give file with z coordinates  ');
eval(['load -ascii ' file]);
z=eval([file]);

%inx=input(' nx for plot ? ')
%inz=input(' nz for plot ? ')
inx=100;
inz=100;

newx=min(x)+(0:inx-1)*(max(x)-min(x))/(inx-1);
newz=min(z)+(0:inz-1)*(max(z)-min(z))/(inz-1);



rmax=max(snap);

disp(' ')
disp(sprintf(' %g snapshots will be displayed ... ',ns))
disp(' ')

disp(' Which colors for snapshots ')
disp(' 1) gray ')
disp(' 2) hsv')
disp(' 3) cool')
disp(' 4) hot')
disp(' 5) jet')
disp(' 6) france')
cans=input(' Which? ');

j0=input(' First snap ');
jinc=input(' Snap inc ');

isnap=0;
for j=j0:jinc:ns;
isnap=isnap+1;
s=reshape(snap((j-1)*nz*nx+1:j*nz*nx),nz,nx);
is=interp2(x',z,s,newx',newz);
is=32+is/max(max(is))*32;
%image(x,z,s),colormap(col),axis('equal'),axis('off'),
image(1:nx,1:nz,is),axis('equal'),axis('off'),
if cans==1, colormap('gray'); end
if cans==2, colormap('hsv'); end
if cans==3, colormap('cool'); end
if cans==4, colormap('hot'); end
if cans==5, colormap('jet'); end
if cans==6, mycolormap('france'); end
title(files),
disp(' Press any key to continue ')
pause
end

