Index: /issm/trunk/src/m/model/plot/plot_BC.m
===================================================================
--- /issm/trunk/src/m/model/plot/plot_BC.m	(revision 10428)
+++ /issm/trunk/src/m/model/plot/plot_BC.m	(revision 10429)
@@ -7,7 +7,19 @@
 
 %plot dirichlets
-h1=plot(md.mesh.x(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),md.mesh.y(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),'ro','MarkerSize',14,'MarkerFaceColor','r');
-h2=plot(md.mesh.x(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),md.mesh.y(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),'bo','MarkerSize',10,'MarkerFaceColor','b');
-h3=plot(md.mesh.x(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),md.mesh.y(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),'yo','MarkerSize',6 ,'MarkerFaceColor','y');
+h1=plot3(...
+	md.mesh.x(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),...
+	md.mesh.y(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),...
+	md.mesh.z(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),...
+	'ro','MarkerSize',14,'MarkerFaceColor','r');
+h2=plot3(...
+	md.mesh.x(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),...
+	md.mesh.y(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),...
+	md.mesh.z(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),...
+	'bo','MarkerSize',10,'MarkerFaceColor','b');
+h3=plot3(...
+	md.mesh.x(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),...
+	md.mesh.y(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),...
+	md.mesh.z(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),...
+	'yo','MarkerSize',6 ,'MarkerFaceColor','y');
 
 %update legend
Index: /issm/trunk/src/m/model/plot/plot_manager.m
===================================================================
--- /issm/trunk/src/m/model/plot/plot_manager.m	(revision 10428)
+++ /issm/trunk/src/m/model/plot/plot_manager.m	(revision 10429)
@@ -65,5 +65,4 @@
 			plot_vertexnumbering(md,options,subplotwidth,i);
 			return;
-		
 		case 'highlightvertices',
 			plot_highlightvertices(md,options,subplotwidth,i);
@@ -87,4 +86,7 @@
 			plot_partition(md,options,nlines,ncols,i);
 			return;
+		case 'referential',
+			plot_referential(md,options,nlines,ncols,i);
+			return;
 		case 'riftvel',
 			plot_riftvel(md,options,nlines,ncols,i);
@@ -93,5 +95,4 @@
 			plot_riftnumbering(md,options,nlines,ncols,i);
 			return;
-
 		case 'rifts',
 			plot_rifts(md,options,nlines,ncols,i);
Index: /issm/trunk/src/m/model/plot/plot_referential.m
===================================================================
--- /issm/trunk/src/m/model/plot/plot_referential.m	(revision 10429)
+++ /issm/trunk/src/m/model/plot/plot_referential.m	(revision 10429)
@@ -0,0 +1,60 @@
+function plot_referential(md,options,width,i,data);
+%PLOT_PRESSURELOAD - plot segment on neumann BC
+%
+%   Usage:
+%      plot_referential(md,options,width,i);
+%
+%   See also: PLOTMODEL
+
+%plot mesh boundaries
+subplot(width,width,i); 
+
+%process mesh and data
+[x y z elements is2d isplanet]=processmesh(md,[],options);
+referential=md.diagnostic.referential;
+
+Xhat=md.diagnostic.referential(:,1:3);
+pos=find(sum(isnan(Xhat),2));
+Xhat(pos,:)=repmat([1 0 0],size(pos,1),1);
+Xhatnorm=sqrt(Xhat(:,1).^2+Xhat(:,2).^2+Xhat(:,3).^2);
+Xhat=Xhat./[Xhatnorm Xhatnorm Xhatnorm];
+
+Zhat=md.diagnostic.referential(:,4:6);
+pos=find(sum(isnan(Zhat),2));
+Zhat(pos,:)=repmat([0 0 1],size(pos,1),1);
+Zhatnorm=sqrt(Zhat(:,1).^2+Zhat(:,2).^2+Zhat(:,3).^2);
+Zhat=Zhat./[Zhatnorm Zhatnorm Zhatnorm];
+
+Yhat=cross(Zhat,Xhat);
+
+if (md.mesh.dimension==2),
+
+	%plot mesh
+	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
+	h1=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
+	hold on;
+
+	xstart=x;
+	ystart=y;
+	zstart=z;
+	edgex=max(md.mesh.x(elements),[],2)-min(md.mesh.x(elements),[],2);
+	len=min(edgex)/1.5;
+	%plot X axis
+	xend=xstart+len*Xhat(:,1);
+	yend=ystart+len*Xhat(:,2);
+	hx=quiver(xstart,ystart,xend-xstart,yend-ystart,'Color','blue','ShowArrowHead','on','AutoScale','off');
+	%plot Y axis
+	xend=xstart+len*Yhat(:,1);
+	yend=ystart+len*Yhat(:,2);
+	hy=quiver(xstart,ystart,xend-xstart,yend-ystart,'Color','red','ShowArrowHead','on','AutoScale','off');
+else
+	error('3d not supported yet')
+end
+
+%legend (disable warnings)
+legend([hx,hy],'local X direction','local Y direction')
+
+%apply options
+options=addfielddefault(options,'title','Diagnostic referential');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/model/plot/plotdoc.m
===================================================================
--- /issm/trunk/src/m/model/plot/plotdoc.m	(revision 10428)
+++ /issm/trunk/src/m/model/plot/plotdoc.m	(revision 10429)
@@ -26,4 +26,5 @@
 disp('                  - ''highlightvertices'': to highlight vertices (use highlight option to enter the vertex list');
 disp('                  - ''mesh'': draw mesh using trisurf');
+disp('                  - ''referential'': diagnostic referential');
 disp('                  - ''riftvel'': velocities along rifts');
 disp('                  - ''riftrelvel'': relative velocities along rifts');
