Index: /issm/trunk-jpl/src/m/plot/checkplotoptions.m
===================================================================
--- /issm/trunk-jpl/src/m/plot/checkplotoptions.m	(revision 14259)
+++ /issm/trunk-jpl/src/m/plot/checkplotoptions.m	(revision 14260)
@@ -81,4 +81,5 @@
 	end
 	textweightvalues=repmat(textweightvalues,1,numtext); textweightvalues(numtext+1:end)=[];
+
 	%3: textsize
 	if exist(options,'textsize'),
@@ -107,5 +108,5 @@
 	end
 	textcolorvalues=repmat(textcolorvalues,1,numtext); textcolorvalues(numtext+1:end)=[];
-	%4: textposition
+	%5: textposition
 	if exist(options,'textposition'),
 		textpositionvalues=getfieldvalue(options,'textposition');
@@ -191,5 +192,5 @@
 	if strcmpi(getfieldvalue(options,'scaleruler'),'on')
 		%default values
-		Lx=max(md.mesh.y)-min(md.mesh.y);
+		Lx=max(md.mesh.x)-min(md.mesh.x);
 		Ly=max(md.mesh.y)-min(md.mesh.y);
 		%default values
Index: /issm/trunk-jpl/src/m/plot/checkplotoptions.py
===================================================================
--- /issm/trunk-jpl/src/m/plot/checkplotoptions.py	(revision 14259)
+++ /issm/trunk-jpl/src/m/plot/checkplotoptions.py	(revision 14260)
@@ -1,2 +1,4 @@
+import numpy as npy
+
 def checkplotoptions(md,options):
 	'''
@@ -11,5 +13,129 @@
 	'''
 
-	print "WARNING: checkplotoptions not implemented: options returned as passed"
+
+	#units
+	if options.exist('unit'):
+		if 'km' in options.getfieldvalue('unit','km'):
+			options.changefieldvalue('unit',10**-3)
+		if '100km' in options.getfieldvalue('unit','100km'):
+			options.changefieldvalue('unit',10**-5)
+	
+	#density
+	if options.exist('density'):
+		density=options.getfieldvalue('density')
+		options.changefieldvalue('density',abs(ceil(density)))
+	
+	#show section
+	if options.exist('showsection'):
+		if 'on' in options.getfieldvalue('showsection','on'):
+			options.changefieldvalue('showsection',4)
+	
+	#smooth values
+	if options.exist('smooth'):
+		if 'on' in options.getfieldvalue('smooth','on'):
+			options.changefieldvalue('smooth',0)
+
+	#contouronly values
+	if options.exist('contouronly'):
+		if 'on' in options.getfieldvalue('contouronly','on'):
+			options.changefieldvalue('contouronly',1)
+
+	#colorbar
+	if options.exist('colorbar'):
+		if 'on' in options.getfieldvalue('colorbar','on'):
+			options.changefieldvalue('colorbar',1)
+		elif 'off' in options.getfieldvalue('colorbar','off'):
+			options.changefieldvalue('colorbar',0)
+
+	#text
+	if options.exist('text'):
+		#1: textvalue
+		textvalues=options.getfieldvalue('text')
+		numtext=len(textvalues)
+
+		#2: textweight
+		if options.exist('textweight'):
+			textweightvalues=options.getfieldvalue('textweight')
+		else:
+			textweightvalues='n'
+		textweightvalues=npy.tile(textweightvalues,numtext)
+
+		#3 textsize
+		if options.exist('textsize'):
+			textsizevalues=options.getfieldvalue('textsize')
+		else:
+			textsizevalues=14
+		textsizevalues=npy.tile(textsizevalues,numtext)
+
+		#4 textcolor
+		if options.exist('textcolor'):
+			textcolorvalues=options.getfieldvalue('textcolor')
+		else:
+			textcolorvalues='k'
+		textcolorvalues=npy.tile(textsizevalues,numtext)
+
+		#5 textposition
+		if options.exist('textposition'):
+			options.getfieldvalue('textposition')
+		else:
+			raise Exception("plotmodel error message: 'textposition' option is missing")
+
+		#6 textrotation
+		if options.exist('textrotation'):
+			textrotationvalues=options.getfieldvalue('textrotation')
+		else:
+			textrotationvalues=0
+		textrotationvalues=npy.tile(textrotationvalues,numtext)
+
+		options.changfieldvalue('text',textvalues)
+		options.changfieldvalue('textsize',textsizevalues)
+		options.changfieldvalue('textweight',textweightvalues)
+		options.changfieldvalue('textcolor',textcolorvalues)
+		options.changfieldvalue('textposition',textpositionvalues)
+		options.changfieldvalue('textrotation',textrotationvalues)
+
+	#expdisp
+	expdispvaluesarray=[0,0]
+	expstylevaluesarray=[0,0]
+	expstylevalues=[0,0]
+	if options.exist('expstyle'):
+		expstylevalues=options.getfieldvalue('expstyle')
+	if options.exist('expdisp'):
+		expdispvalues=options.getfieldvalue('expdisp')
+		for i in npy.arange(len(expdispvalues)):
+			expdispvaluesarray.append(expdispvalues[i])
+			if len(expstylevalues)>i+1:
+				expstylevaluesarray.append(expstylevalues[i])
+			else:
+				expstylevaluesarray.append('-k')
+
+	options.changefieldvalue('expstyle',expstylevaluesarray)
+	options.changefieldvalue('expdisp',expdispvaluesarray)
+
+	#latlonnumbering
+	if options.exist('latlonclick'):
+		if 'on' in options.getfieldvalue('latlonclick','on'):
+			options.changefieldvalue('latlonclick',1)
+
+	#northarrow
+	if options.exist('northarrow'):
+		if 'on' in options.getfieldvalue('northarrow','on'):
+			#default values
+			Lx=max(md.mesh.x)-min(md.mesh.x)
+			Ly=max(md.mesh.y)-min(md.mesh.y)
+			options.changefieldvalue('northarrow',[min(md.mesh.x)+1./6.*Lx, min(md.mesh.y)+5./6.*Ly, 1./15.*Ly, 0.25, 1./250.*Ly])
+
+	#scale ruler
+	if options.exist('scaleruler'):
+		if 'on' in options.exist('scaleruler','on'):
+			Lx=max(md.mesh.x)-min(md.mesh.x)
+			Ly=max(md.mesh.y)-min(md.mesh.y)
+			options.changefieldvalue('scaleruler',[min(md.mesh.x)+6./8.*Lx, min(md.mesh.y)+1./10.*Ly, 10**(ceil(log10(Lx)))/5, floor(Lx/100), 5])
+
+	#log scale
+	if options.exist('log'):
+		if options.exist('caxis'):
+			options.changefieldvalue('caxis',log(options.getfieldvalue('caxis'))/log(options.getfieldvalue('log')))
+		options.changefieldvalue('cutoff',log(options.getfieldvalue('cutoff',1.5))/log(options.getfieldvalue('log')))
+
 	return options
-
Index: /issm/trunk-jpl/src/m/plot/plotmodel.py
===================================================================
--- /issm/trunk-jpl/src/m/plot/plotmodel.py	(revision 14259)
+++ /issm/trunk-jpl/src/m/plot/plotmodel.py	(revision 14260)
@@ -1,2 +1,3 @@
+import numpy as npy
 
 try:
@@ -21,4 +22,8 @@
 	subplotwidth=ceil(sqrt(options.numberofplots))
 	
+	#Get figure number and number of plots
+	figurenumber=options.figurenumber
+	numberofplots=options.numberofplots
+
 	#if nlines and ncols specified, then bypass
 	if options.list[0].exist('nlines'):
@@ -26,5 +31,5 @@
 		nl=True
 	else:
-		nlines=subplotwidth
+		nlines=npy.ceil(numberofplots/subplotwidth)
 		nl=False
 	
@@ -40,7 +45,4 @@
 		raise StandardError('error: nlines and ncols need to be specified together, or not at all')
 	
-	#Get figure number and number of plots
-	figurenumber=options.figurenumber
-	numberofplots=options.numberofplots
 	
 	#Go through plots
