Index: /issm/trunk-jpl/src/m/plot/applyoptions.py
===================================================================
--- /issm/trunk-jpl/src/m/plot/applyoptions.py	(revision 17639)
+++ /issm/trunk-jpl/src/m/plot/applyoptions.py	(revision 17640)
@@ -157,8 +157,9 @@
 	elif options.exist('caxis'):
 		lims=options.getfieldvalue('caxis')
-		if len(lims)!=2:
-			print 'WARNING: clim/caxis should be passed as a list of length 2'
-		else:
-			p.clim(lims[0],lims[1])
+		options.addfielddefault('clim',lims)
+	else:
+		lims=[min(data.flatten()),max(data.flatten())]
+	if len(lims)!=2:
+		print 'WARNING: clim/caxis should be passed as a list of length 2'
 	#}}}
 
@@ -179,22 +180,28 @@
 	#colorbar {{{
 	if options.getfieldvalue('colorbar',1)==1:
-		if options.exist('clim'):
-			# build custom colorbar (does not yet allow customizing the location)
-			fig = p.gcf()
-			ax = p.gca()
-			divider = make_axes_locatable(ax)
-			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
-			fig.add_axes(cax) 
-			norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
-			cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
-		else:
-			# build custom colorbar (does not yet allow customizing the location)
-			fig = p.gcf()
-			ax = p.gca()
-			divider = make_axes_locatable(ax)
-			cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
-			fig.add_axes(cax) 
-			norm = mpl.colors.Normalize(vmin=npy.min(data.flatten()), vmax=npy.max(data.flatten()))
-			cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
+		fig = p.gcf()
+		ax = p.gca()
+		divider = make_axes_locatable(ax)
+		cax = divider.new_horizontal("5%", pad=0.05, axes_class=mpl.axes.Axes)
+		fig.add_axes(cax) 
+		norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+		cbar_extend=0
+		if options.exist('cmap_set_over'):
+			over=options.getfieldvalue('cmap_set_over','0.5')
+			cmap.set_over(over)
+			cbar_extend+=1
+		if options.exist('cmap_set_under'):
+			under=options.getfieldvalue('cmap_set_under','0.5')
+			cmap.set_under(under)
+			cbar_extend+=2
+		if cbar_extend==0:
+			extend='neither'
+		elif cbar_extend==1:
+			extend='max'
+		elif cbar_extend==2:
+			extend='min'
+		elif cbar_extend==3:
+			extend='both'
+		cb = mpl.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm, extend=extend)
 		cb.locator=MaxNLocator(nbins=5) # default 5 ticks
 		cb.update_ticks()
Index: /issm/trunk-jpl/src/m/plot/plot_unit.py
===================================================================
--- /issm/trunk-jpl/src/m/plot/plot_unit.py	(revision 17639)
+++ /issm/trunk-jpl/src/m/plot/plot_unit.py	(revision 17640)
@@ -7,53 +7,70 @@
 
 def plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options):
-	"""
-	PLOT_UNIT - unit plot, display data
+   """
+   PLOT_UNIT - unit plot, display data
+   
+   	Usage:
+   		plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
+   
+   	See also: PLOTMODEL, PLOT_MANAGER
+   """
 
-		Usage:
-			plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
+   #edgecolor
+   edgecolor=options.getfieldvalue('edgecolor','None')
+   
+   #number of colorlevels for plots
+   colorlevels=options.getfieldvalue('colorlevels',256)
+   
+   #colormap
+   cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
+   cbar_extend=0
+   if options.exist('cmap_set_over'):
+      over=options.getfieldvalue('cmap_set_over','0.5')
+      cmap.set_over(over)
+      cbar_extend+=1
+   if options.exist('cmap_set_under'):
+      under=options.getfieldvalue('cmap_set_under','0.5')
+      cmap.set_under(under)
+      cbar_extend+=1
 
-		See also: PLOTMODEL, PLOT_MANAGER
-	"""
-
-	#edgecolor
-	edgecolor=options.getfieldvalue('edgecolor','None')
-
-	#number of colorlevels for plots
-	colorlevels=options.getfieldvalue('colorlevels',256)
-
-	#colormap
-	cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
-
-	if datatype==1:
-		#element plot
-		if is2d:
-			p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
-		else:
-			raise ValueError('plot_unit error: 3D element plot not supported yet')
-		return
-
-	elif datatype==2:
-		#node plot
-		if is2d:
-			p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap)
-			if edgecolor != 'None':
-				p.triplot(x,y,elements,color=edgecolor)
-		else:
-			raise ValueError('plot_unit error: 3D node plot not supported yet')
-		return
-
-	elif datatype==3:
-		print 'plot_unit message: quiver plot not implemented yet'
-		return
-
-	elif datatype==4:
-		#P1 patch plot
-		print 'plot_unit message: P1 patch plot not implemented yet'
-		return
-
-	elif datatype==5:
-		print 'plot_unit message: P0 patch plot not implemented yet'
-		return
-
-	else:
+   #normalize colormap if clim/caxis specified
+   if options.exist('clim'):
+      lims=options.getfieldvalue('clim',[min(data),max(data)])
+   elif options.exist('caxis'):
+      lims=options.getfieldvalue('caxis',[min(data),max(data)])
+   else:
+      lims=[min(data),max(data)]
+   norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+   if datatype==1:
+      #element plot
+   	if is2d:
+   		p.tripcolor(x,y,elements,data,colorlevels,edgecolors=edgecolor)
+   	else:
+   		raise ValueError('plot_unit error: 3D element plot not supported yet')
+   	return
+   
+   elif datatype==2:
+   	#node plot
+   	if is2d:
+   		p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm)
+   		if edgecolor != 'None':
+   			p.triplot(x,y,elements,color=edgecolor)
+   	else:
+   		raise ValueError('plot_unit error: 3D node plot not supported yet')
+   	return
+   
+   elif datatype==3:
+   	print 'plot_unit message: quiver plot not implemented yet'
+   	return
+   
+   elif datatype==4:
+   	#P1 patch plot
+   	print 'plot_unit message: P1 patch plot not implemented yet'
+   	return
+   
+   elif datatype==5:
+   	print 'plot_unit message: P0 patch plot not implemented yet'
+   	return
+   
+   else:
 		raise ValueError('datatype=%d not supported' % datatype)
