Index: issm/trunk/src/m/plot/processdata.py
===================================================================
--- issm/trunk/src/m/plot/processdata.py	(revision 26744)
+++ issm/trunk/src/m/plot/processdata.py	(revision 27232)
@@ -8,5 +8,7 @@
     datatype = 2 -> nodes
     datatype = 3 -> node quivers
-    datatype = 4 -> patch
+    datatype = 4 -> P1 patch
+    datatype = 5 -> P0 patch
+    datatype = 6 -> edges
 
     Usage:
@@ -24,4 +26,9 @@
     else:
         numberofvertices2d = np.nan
+
+    try:
+        numberofedges = md.mesh.numberofedges
+    except AttributeError:
+        numberofedges = np.nan
 
     if options.exist('amr'):
@@ -52,5 +59,5 @@
     # }}}
 
-    #  log {{{
+    # log {{{
     if options.exist('log'):
         cutoff = options.getfieldvalue('log', 1)
@@ -58,13 +65,27 @@
     # }}}
 
-    #  quiver plot {{{
+    # quiver plot {{{
     if datasize[1] > 1 and datasize[0] != numberofvertices + 1:
-        if datasize[0] == numberofvertices and datasize[1] == 2:
+        if datasize[0] == numberofvertices and datasize[1] in [2, 3]:
             datatype = 3
+            if md.mesh.dimension() == 3:
+                if datasize[1] == 2:
+                    data = np.hstack(data, np.zeros((datasize[0])))
+                elif datasize[1] > 3:
+                    raise ValueError('plotmodel error message: data should have two or three columns of length md.mesh.numberofvertices for a quiver plot')
         else:
-            raise ValueError('plotmodel error message: data should have two columns of length md.mesh.numberofvertices for a quiver plot')
+            #we should have a patch
+            print("Assuming that data provided is a patch")
+            datatype = 4
+            index = md.mesh.elements
+            if np.shape(data)[1] < np.shape(index)[1]:
+                    raise ValueError('plotmodel error message: data should have more columns than vertices per elements to plot a patch')
+            procdata = np.zeros((numberofvertices))
+            procdata[md.mesh.elements -1] = data[:, 0:np.shape(index)[1]]
+            datasize = [numberofvertices, 1]
+
     # }}}
 
-    #  element data{{{
+    # element data{{{
     if datasize[0] == numberofelements and datasize[1] == 1:
         #initialize datatype if non patch
@@ -93,6 +114,6 @@
     # }}}
 
-    #  node data {{{
-    if datasize[0] in [numberofvertices, numberofvertices2d] and datasize[1] == 1:
+    # node data {{{
+    elif datasize[0] in [numberofvertices, numberofvertices2d] and datasize[1] == 1:
         datatype = 2
         # AMR {{{
@@ -101,5 +122,5 @@
             procdata = procdata[nonan]
         # }}}
-        #  Mask {{{
+        # Mask {{{
         if options.exist('mask'):
             flags = options.getfieldvalue('mask')
@@ -119,6 +140,19 @@
     # }}}
 
-    #  spc time series {{{
-    if datasize[0] == numberofvertices + 1:
+    # edge data {{{
+    elif datasize[0] in [numberofedges] and datasize[1] == 1:
+        datatype = 6
+        procdata = np.zeros((md.mesh.numberofelements))
+        repeat = np.zeros((md.mesh.numberofelements))
+        for index, edge in enumerate(md.mesh.edges[:, -2:]):
+            procdata[edge - 1] += data[index] * np.asarray(edge - 1 > -1, dtype=int)
+            repeat[edge - 1] += np.asarray(edge - 1 > -1, dtype=int)
+        procdata = procdata / repeat
+
+        # }}}
+    # }}}
+
+    # spc time series {{{
+    elif datasize[0] == numberofvertices + 1:
         datatype = 2
         spccol = options.getfieldvalue('spccol', 0)
@@ -127,12 +161,7 @@
         procdata = procdata[0:-1, spccol]
 
-        #mask?
-
-        #layer projection?
-
-        #control arrow density if quiver plot
     # }}}
 
-    # convert rank - 2 array to rank - 1 {{{
+    # convert rank -2 array to rank -1 {{{
     if np.ndim(procdata) == 2 and np.shape(procdata)[1] == 1:
         procdata = procdata.reshape(-1, )
@@ -142,16 +171,23 @@
     nanfill = options.getfieldvalue('nan', -9999)
     if np.any(np.isnan(procdata)):
-        lb = np.nanmin(procdata)
-        ub = np.nanmax(procdata)
-        if lb == ub:
-            lb = lb - 0.5
-            ub = ub + 0.5
-            nanfill = lb - 1
+        if options.exist('caxis'):
+            [lb, ub] = options.getfieldvalue('caxis')
+        else:
+            lb = np.nanmin(procdata)
+            ub = np.nanmax(procdata)
+            if lb == ub:
+                lb = lb - 0.5
+                ub = ub + 0.5
+                nanfill = lb - 1
+            options.addfielddefault('caxis', [lb, ub])
+
         procdata[np.isnan(procdata)] = nanfill
         procdata = np.ma.array(procdata, mask=np.isnan(procdata))
-        #clim looks to be deprecated and replaced by caxis
-        #options.addfielddefault('clim', [lb, ub])
-        options.addfielddefault('cmap_set_under', '1')
-        print(("WARNING: nan's treated as", nanfill, "by default.  Change using pairoption 'nan', nan_fill_value in plotmodel call"))
+        if nanfill < lb:
+            options.addfielddefault('cmap_set_under', 'r')
+        elif nanfill > ub:
+            options.addfielddefault('cmap_set_over', 'k')
+        if nanfill < ub and nanfill > lb:
+            print(("WARNING: nan's treated as", nanfill, "by default. Which is in your data interval, change it with ['nan', value] in plotmodel options"))
     # }}}
 
