Index: issm/trunk-jpl/src/py3/plot/plotmodel.py
===================================================================
--- issm/trunk-jpl/src/py3/plot/plotmodel.py	(revision 21255)
+++ issm/trunk-jpl/src/py3/plot/plotmodel.py	(revision 23670)
@@ -1,4 +1,7 @@
-import numpy as np
+import numpy as  np
 from plotoptions import plotoptions
+from plotdoc import plotdoc
+from plot_manager import plot_manager
+from math import ceil, sqrt
 
 try:
@@ -6,21 +9,17 @@
 	import matplotlib.pyplot as plt
 	from mpl_toolkits.axes_grid1 import ImageGrid, AxesGrid
+	from mpl_toolkits.mplot3d import Axes3D
 except ImportError:
 	print("could not import pylab, matplotlib has not been installed, no plotting capabilities enabled")
 
-from plot_manager import plot_manager
-from math import ceil, sqrt
-
 def plotmodel(md,*args):
-	'''
-	at command prompt, type 'plotdoc' for additional documentation
+	'''	at command prompt, type 'plotdoc()' for additional documentation
 	'''
 
-	#First process options 
+	#First process options
 	options=plotoptions(*args)
 
 	#get number of subplots
 	subplotwidth=ceil(sqrt(options.numberofplots))
-	
 	#Get figure number and number of plots
 	figurenumber=options.figurenumber
@@ -37,5 +36,5 @@
 		nrows=np.ceil(numberofplots/subplotwidth)
 		nr=False
-	
+
 	if options.list[0].exist('ncols'):
 		ncols=options.list[0].getfieldvalue('ncols')
@@ -46,12 +45,11 @@
 	ncols=int(ncols)
 	nrows=int(nrows)
-	
+
 	#check that nrows and ncols were given at the same time!
 	if not nr==nc:
 		raise Exception('error: nrows and ncols need to be specified together, or not at all')
-	
+
 	#Go through plots
 	if numberofplots:
-		
 		#if plt.fignum_exists(figurenumber): 
 		#	plt.cla()
@@ -60,22 +58,32 @@
 		if options.list[0].exist('figsize'):
 			figsize=options.list[0].getfieldvalue('figsize')
-			fig=plt.figure(figurenumber,figsize=(figsize[0],figsize[1]),tight_layout=True)
+			fig=plt.figure(figurenumber,figsize=(figsize[0],figsize[1]))#,tight_layout=True)
 		else:
-			fig=plt.figure(figurenumber,tight_layout=True)
+			fig=plt.figure(figurenumber)#,tight_layout=True)
 		fig.clf()
 
+		backgroundcolor=options.list[0].getfieldvalue('backgroundcolor',(0.7,0.7,0.7))
+		fig.set_facecolor(backgroundcolor)
+
+
+		translator={'on':'each',
+								'off':'None',
+								'one':'single'}
 		# options needed to define plot grid
+		plotnum=options.numberofplots
 		direction=options.list[0].getfieldvalue('direction','row') # row,column
 		axes_pad=options.list[0].getfieldvalue('axes_pad',0.25)
 		add_all=options.list[0].getfieldvalue('add_all',True) # True,False
 		share_all=options.list[0].getfieldvalue('share_all',True) # True,False
-		label_mode=options.list[0].getfieldvalue('label_mode','1') # 1,L,all
-		cbar_mode=options.list[0].getfieldvalue('cbar_mode','each') # none,single,each
-		cbar_location=options.list[0].getfieldvalue('cbar_location','right') # right,top
-		cbar_size=options.list[0].getfieldvalue('cbar_size','5%')
-		cbar_pad=options.list[0].getfieldvalue('cbar_pad','2.5%') # None or %
-		
-		axgrid=ImageGrid(fig, 111,
+		label_mode=options.list[0].getfieldvalue('label_mode','L') # 1,L,all
+		colorbar=options.list[0].getfieldvalue('colorbar','on') # on, off (single)
+		cbar_mode=translator[colorbar]
+		cbar_location=options.list[0].getfieldvalue('colorbarpos','right') # right,top
+		cbar_size=options.list[0].getfieldvalue('colorbarsize','5%')
+		cbar_pad=options.list[0].getfieldvalue('colorbarpad','2.5%') # None or %
+
+		axgrid=ImageGrid(fig,111,
 				nrows_ncols=(nrows,ncols),
+				ngrids=plotnum,
 				direction=direction,
 				axes_pad=axes_pad,
@@ -86,13 +94,12 @@
 				cbar_location=cbar_location,
 				cbar_size=cbar_size,
-				cbar_pad=cbar_pad
-				)
+				cbar_pad=cbar_pad)
 
-		if cbar_mode=='none':
-			for ax in axgrid.cbar_axes: fig._axstack.remove(ax)
+		if cbar_mode=='None':
+			for ax in axgrid.cbar_axes: 
+				fig._axstack.remove(ax)
 
-		for i in range(numberofplots):
-			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],fig,axgrid[i])
-
+		for i,ax in enumerate(axgrid.axes_all):
+			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],fig,axgrid,i)
 		fig.show()
 	else:
