function figure_origami(surf,value)
%
% function figure_origami(surf,value, cmap)
% 
% Color mesh vertices of "surf" using given "value" using colormap "cmap". 
% If "cmap" is not given, the MATLAB default colormap will be used.
%
% cmap options:  "rwb" : red-white-blue
%                       "ryw" : red-yellow-white
%
%  (C) 2008. Moo K. Chung   mkchung@wisc.edu
%  Modified from Keith Worsley's SurfStat routine 
% Last update April 29, 2008.

figure;
coord=surf.vertices;
tri=surf.faces;

background='white';
h=0.39;
w=0.4;

clim=[min(value),max(value)];
if clim(1)==clim(2)
    clim=clim(1)+[-1 0];
end

clf;
%colormap(spectral(256));

b=0.55;
%a(1)=axes('position',[0.055 0.62 h*3/4 w]);
a(1)=axes('position',[0 b h*3/4 w]);
trisurf(tri,-coord(:,1), coord(:,2),-coord(:,3),value);
view(-90,0); 
daspect([1 1 1]); axis tight; camlight; axis vis3d off;
lighting phong; material shiny; shading interp;

a(2)=axes('position',[0.3 b w h]);
trisurf(tri,-coord(:,1), coord(:,2),-coord(:,3),value);
view(0,0); 
daspect([1 1 1]); axis tight; camlight; axis vis3d off;
lighting phong; material shiny; shading interp;

%a(3)=axes('position',[1-0.055-h*3/4 0.62 h*3/4 w]);
a(3)=axes('position',[1-h*3/4 b h*3/4 w]);
trisurf(tri,-coord(:,1), coord(:,2),-coord(:,3),value);
view(90,0); 
daspect([1 1 1]); axis tight; camlight; axis vis3d off;
lighting phong; material shiny; shading interp;

%a(4)=axes('position',[0.055 0.29 h*3/4 w]);
a(4)=axes('position',[0.3 0.12 w h]);
trisurf(tri,-coord(:,1), -coord(:,2),coord(:,3),value);
view(0,0); 
daspect([1 1 1]); axis tight; camlight; axis vis3d off;
lighting phong; material shiny; shading interp;


cb=colorbar('location','South');
%set(cb,'Position',[0.35 0.085 0.3 0.03]);
set(cb,'Position',[0.35 0.043 0.3 0.03]);

set(cb,'XAxisLocation','bottom');
%h=get(cb,'Title');
%set(h,'String',title);

whitebg(gcf,background);
set(gcf,'Color',background,'InvertHardcopy','off');

dcm_obj=datacursormode(gcf);
set(dcm_obj,'UpdateFcn',@SurfStatDataCursor,'DisplayStyle','window');



% a(1)=axes('position',[0.055 0.62 h*3/4 w]);
% trisurf(tri,coord(:,1), coord(:,2),coord(:,3),value);colorbar;
% view(-90,0); 
% daspect([1 1 1]); axis tight; camlight; axis vis3d off;
% lighting phong; material shiny; shading interp;
% 
% a(2)=axes('position',[0.3 0.58 w h]);
% trisurf(tri,coord(:,1), coord(:,2),coord(:,3),value);colorbar;
% view(0,90); 
% daspect([1 1 1]); axis tight; camlight; axis vis3d off;
% lighting phong; material shiny; shading interp;
% 
% a(3)=axes('position',[1-0.055-h*3/4 0.62 h*3/4 w]);
% trisurf(tri,coord(:,1), coord(:,2),coord(:,3),value);colorbar;
% view(90,0); 
% daspect([1 1 1]); axis tight; camlight; axis vis3d off;
% lighting phong; material shiny; shading interp;
% 
% a(4)=axes('position',[0.055 0.29 h*3/4 w]);
% trisurf(tri,coord(:,1), coord(:,2),coord(:,3),value);colorbar;
% view(90,0); 
% daspect([1 1 1]); axis tight; camlight; axis vis3d off;
% lighting phong; material shiny; shading interp;

