Index: /issm/trunk-jpl/src/m/plot/plotmodel.m
===================================================================
--- /issm/trunk-jpl/src/m/plot/plotmodel.m	(revision 27291)
+++ /issm/trunk-jpl/src/m/plot/plotmodel.m	(revision 27292)
@@ -10,5 +10,5 @@
 
 %get number of subplots
-subplotwidth=ceil(sqrt(options.numberofplots));
+subplotwidth=ceil(sqrt(numberofplots));
 
 %if nlines and ncols specified, then bypass.
@@ -24,6 +24,21 @@
 
 %check that nlines and ncols were given at the same time!
-if ((exist(options.list{1},'ncols') & ~exist(options.list{1},'ncols')) | (~exist(options.list{1},'ncols') & exist(options.list{1},'nicols')))
+if ((exist(options.list{1},'ncols') & ~exist(options.list{1},'ncols')) | (~exist(options.list{1},'ncols') & exist(options.list{1},'ncols')))
 	error('plotmodel error message: nlines and ncols  need to be specified together, or not at all');
+end
+
+% Add option for subplot, only support one subplot per one plotmodel call
+subindex = 0;
+if (exist(options.list{1},'subplot'))
+    subops = getfieldvalue(options.list{1},'subplot',NaN);
+    nlines = subops(1);
+    ncols = subops(2);
+    subindex = subops(3);
+    % change the width
+    subplotwidth = ncols;
+    % Turn off new figure option for subplot
+    options.list{1}=addfield(options.list{1},'figurestatement','off');
+    % Turn off clf option for subplot
+    options.list{1}=addfield(options.list{1},'clf','off');
 end
 
@@ -32,5 +47,5 @@
 
 	%Create figure 
-	if strcmpi(getfieldvalue(options.list{1},'figurestatement','on'),'on'),
+	if (strcmpi(getfieldvalue(options.list{1},'figurestatement','on'),'on'))
 		f=figure(figurenumber); 
 	else
@@ -86,10 +101,10 @@
 		else
 			set(gcf,'Position',figposition);
-        end
-   elseif strcmpi(getenv('USER'),'inwoo')
-        set(gcf,'Position',[910 242 560 420]);
+		end
+	elseif strcmpi(getenv('USER'),'inwoo')
+		set(gcf,'Position',[910 242 560 420]);
 	end % }}}
 
-	%Use zbuffer renderer (snoother colors) and white background
+	%Use zbuffer renderer (smoother colors) and white background
 	set(f,'Renderer','zbuffer','color',getfieldvalue(options.list{1},'figurebackgroundcolor','w'));
 
@@ -97,6 +112,10 @@
 	try,
 		for i=1:numberofplots,
-			plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
-			%List all unused options
+            if subindex
+                plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,subindex);
+            else
+                plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
+            end
+            %List all unused options
 			if getfieldvalue(options.list{i},'displayunused',1),
 				displayunused(options.list{i})
@@ -108,4 +127,4 @@
 	end
 else
-	error('plotmodel error message: no output data found. ');
+	error('plotmodel error message: no output data found.');
 end
