Index: ../trunk-jpl/src/m/classes/plotoptions.py
===================================================================
--- ../trunk-jpl/src/m/classes/plotoptions.py	(revision 13416)
+++ ../trunk-jpl/src/m/classes/plotoptions.py	(revision 13417)
@@ -92,10 +92,12 @@
 					#Empty
 					if not plotnum: continue
 
+					# '#all'
 					elif 'all' in plotnum:
 						for j in xrange(numberofplots):
 							self.list[j].addfield(field,rawlist[i][1])
 
+					# '#i-j'
 					elif '-' in plotnum:
 						nums=plotnum.split('-')
 						if len(nums)!=2: continue
Index: ../trunk-jpl/src/m/plot/plot_mesh.py
===================================================================
--- ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 13416)
+++ ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 13417)
@@ -1,5 +1,6 @@
 import pylab as p
-import matplotlib.tri as tri
+from processmesh import processmesh
+from applyoptions import applyoptions
 
 def plot_mesh(md,options,nlines,ncols,i):
 	'''
@@ -11,14 +12,14 @@
 		See also: PLOTMODEL
 	'''
 
-	#TODO: implement processmesh
-	x=md.mesh.x
-	y=md.mesh.y
-	elements=md.mesh.elements
-	elements=elements-1 #since python indexes from zero
+	x,y,z,elements,is2d=processmesh(md,[],options)
 
-	p.subplot(nlines,ncols,i)
-	p.triplot(x,y,elements)
-	p.title('Mesh')
+	if is2d:
+		p.subplot(nlines,ncols,i)
+		p.triplot(x,y,elements)
+	else:
+		print 'WARNING: only 2D mesh plot is currently implemented'
 	
-	print 'WARNING: options passed to plot_mesh not implemented yet'
+	#apply options
+	options.addfielddefault('title','Mesh')
+	applyoptions(md,[],options)
Index: ../trunk-jpl/src/m/plot/processmesh.py
===================================================================
--- ../trunk-jpl/src/m/plot/processmesh.py	(revision 0)
+++ ../trunk-jpl/src/m/plot/processmesh.py	(revision 13417)
@@ -0,0 +1,86 @@
+from math import isnan
+
+def processmesh(md,data,options):
+	"""
+	PROCESSMESH - process the mesh for plotting
+
+	Usage:
+		[x y z elements is2d]=processmech(md,data,options)
+
+	See also: PLOTMODEL, PROCESSDATA
+	"""
+
+	#some checks
+	if md.mesh.numberofvertices==0:
+		raise ValueError('processmesh error: mesh is empty')
+	if md.mesh.numberofvertices==md.mesh.numberofelements:
+		raise ValueError('processmesh error: the number of elements is the same as the number of nodes')
+
+	if not data or not isinstance(data,dict):
+		
+		if 'latlon' not in options.getfieldvalue('coord','xy').lower(): #convert to lower case for comparison
+			x=md.mesh.x
+			if not isnan(md.mesh.x2d): x2d=md.mesh.x2d
+			y=md.mesh.y
+			if not isnan(md.mesh.y2d): y2d=md.mesh.y2d
+		else:
+			x=md.mesh.long
+			y=md.mesh.lat
+
+		z_field=options.getfieldvalue('z',md.mesh.z)
+		#if isinstance(z_field,basestring): # how could z be a string?
+		#	z=md.(z_field)
+		if isinstance(z_field,(int,long,float)):  # isnumeric
+			z=z_field
+		else:
+			z=md.mesh.z
+		
+		if not isnan(md.mesh.elements2d): 
+			elements2d=md.mesh.elements2d
+			elements2d=elements2d-1
+		# subtract one since python indexes from zero
+		elements=md.mesh.elements
+		elements=elements-1
+
+		#is it a 2D plot?
+		if md.mesh.dimension==2:
+			is2d=1
+		elif md.mesh.dimension==3:
+			if options.getfieldvalue('layer',0)>=1:
+				is2d=1
+			else:
+				is2d=0
+		else:
+			raise ValueError('processmesh error: dim = %d not supported')
+
+		#layer projection?
+		if options.getfieldvalue('layer',0)>=1:
+			 if 'latlon' in options.getfieldvalue('coord','xy').lower():
+				 raise ValueError('processmesh error: cannot work with 3D mesh in lat-lon coords')
+			#we modify (w/c?) the mesh temporarily to a 2D mesh from which the 3D mesh was extruded
+			 x=x2d
+			 y=y2d
+			 z=zeros(size(x2d))
+			 elements=elements2d
+	
+	else:
+		#Process mesh for plotting (triangulation for 2D, polycollection for 3D?)
+		if md.mesh.dimension==2:
+			is2d=1
+		else:
+			# process polycollection here for 3D plot
+			is2d=0
+	
+	#units
+	if options.exist('unit'):
+		unit=options.getfieldvalue('unit')
+		x=x*unit
+		y=y*unit
+		z=z*unit
+
+	##is model a member of planet class? (won't work until planet class defined)
+	#if isinstance(md,planet):
+	#	isplanet=1
+	#else:
+	#	isplanet=0
+	return x,y,z,elements,is2d
Index: ../trunk-jpl/src/m/plot/plotmodel.py
===================================================================
--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 13416)
+++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 13417)
@@ -1,7 +1,8 @@
 import pylab as p
 #from pairoptions import *
-from plotoptions import *
-from plot_manager import *
+from plotoptions import plotoptions
+from plot_manager import plot_manager
+from math import ceil, sqrt
 
 def plotmodel(md,*args):
 	'''
@@ -12,7 +13,7 @@
 	options=plotoptions(*args)
 
 	#get number of subplots
-	subplotwidth=math.ceil(math.sqrt(options.numberofplots))
+	subplotwidth=ceil(sqrt(options.numberofplots))
 	
 	#if nlines and ncols specified, then bypass
 	if options.list[0].exist('nlines'):
@@ -43,13 +44,20 @@
 		#Create figure
 		#plots will be visible by default if ipython is run in interactive mode (invoked by ipython --pylab)
 		#handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
-		p.figure(figurenumber)
+
+		#if figsize specified
+		if options.list[0].exist('figsize'):
+			figsize=options.list[0].getfieldvalue('figsize')
+			p.figure(figurenumber,figsize=figsize)
+		else:
+			p.figure(figurenumber)
+
 	
-		try:
-			for i in xrange(numberofplots):
-				plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i)
-		except StandardError:
-			print 'error in plot_manager'
+		#try:
+		for i in xrange(numberofplots):
+			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i)
+		#except StandardError:
+		#	print 'error in plot_manager'
 	else:
 		raise StandardError('plotmodel error message: no output data found.')
 			
Index: ../trunk-jpl/src/m/plot/applyoptions.py
===================================================================
--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 0)
+++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 13417)
@@ -0,0 +1,145 @@
+from matplotlib.font_manager import FontProperties
+import pylab as p
+
+def applyoptions(md,data,options):
+	'''
+	APPLYOPTIONS - apply options to current plot
+
+		Usage:
+			applyoptions(md,data,options)
+
+		See also: PLOTMODEL, PARSE_OPTIONS
+	'''
+
+	#some defaults (this seems to be adding a field that already exists...)
+	#if not isnan(md.mesh.hemisphere):
+	#	options.addfielddefault('hemisphere',md.mesh.hemisphere)
+
+	#font
+	fontsize=options.getfieldvalue('fontsize',14)
+	fontweight=options.getfieldvalue('fontweight','normal')
+	fontfamily=options.getfieldvalue('fontfamily','sans-serif')
+	font={
+			'fontsize'		:fontsize,
+			'fontweight'	:fontweight,
+			'family'			:fontfamily
+			}
+
+	#title
+	if options.exist('title'):
+		title=options.getfieldvalue('title')
+		if options.exist('titlefontsize'):
+			titlefontsize=options.getfieldvalue('titlefontsize')
+		else:
+			titlefontsize=fontsize
+		if options.exist('titlefontweight'):
+			titlefontweight=options.getfieldvalue('titlefontweight')
+		else:
+			titlefontweight=fontweight
+		#title font
+		titlefont=font.copy()
+		titlefont['size']=titlefontsize
+		titlefont['weight']=titlefontweight
+		p.title(title,**titlefont)
+		
+	#xlabel, ylabel, zlabel
+	if options.exist('labelfontsize'):
+		labelfontsize=options.getfieldvalue('labelfontsize')
+	else:
+		labelfontsize=fontsize
+	if options.exist('labelfontweight'):
+		labelfontweight=options.getfieldvalue('labelfontweight')
+	else:
+		labelfontweight=fontweight
+
+	#font dict for labels
+	labelfont=font.copy()
+	labelfont['fontsize']=labelfontsize
+	labelfont['fontweight']=labelfontweight
+
+	if options.exist('xlabel'):
+		p.xlabel(options.getfieldvalue('xlabel'),**labelfont)
+	if options.exist('ylabel'):
+		p.ylabel(options.getfieldvalue('ylabel'),**labelfont)
+	if options.exist('zlabel'):
+		p.zlabel(options.getfieldvalue('zlabel'),**labelfont)
+
+	#xticks, yticks, zticks
+
+	#view
+
+	#axis
+
+	#box
+
+	#xlim, ylim, zlim
+	if options.exist('xlim'):
+		p.xlim(options.getfieldvalue('xlim'))
+	if options.exist('ylim'):
+		p.xlim(options.getfieldvalue('ylim'))
+	if options.exist('zlim'):
+		p.xlim(options.getfieldvalue('zlim'))
+
+	#latlon
+
+	#Basinzoom
+
+	#ShowBasins
+
+	#Caxis
+
+	#shading
+
+	#grid
+	if options.exist('grid'):
+		p.grid()
+
+	#colormap
+
+	#wrapping
+
+	#colorbar
+
+	#area
+
+	#expdisp
+
+	#text
+
+	#north arrow
+
+	#scale ruler
+
+	#streamlines
+
+	#contours
+
+	#YTickLabel
+
+	#XTickLabel
+
+	#xtick
+
+	#ytick
+
+	#axis positions
+
+	#figure position
+
+	#axes position
+
+	#showregion
+
+	#flat edges of a partition
+
+	#scatter
+
+	#backgroundcolor
+
+	#figurebackgroundcolor
+
+	#lighting
+
+	#point cloud
+
+	#inset
