Index: trunk/Ohana/src/opihi/cmd.data/zplot.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/zplot.c	(revision 20936)
+++ trunk/Ohana/src/opihi/cmd.data/zplot.c	(revision 31667)
@@ -58,3 +58,60 @@
 }
 
+int zcplot (int argc, char **argv) {
+  
+  int i, kapa;
+  opihi_flt *out;
+  double min, range;
+  Graphdata graphmode;
+  Vector *xvec, *yvec, *zvec, Zvec;
 
+  if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE);
+
+  if (argc != 6) {
+    gprint (GP_ERR, "USAGE: zplot <x> <y> <z> min max\n");
+    return (FALSE);
+  }
+
+  min = atof(argv[4]);
+  range = atof(argv[5]) - min;
+
+  /* find vectors */
+  if ((xvec = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE);
+  if ((yvec = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE);
+  if ((zvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE);
+  if (xvec[0].Nelements != yvec[0].Nelements) {
+    gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]);
+    return (FALSE);
+  }
+  if (xvec[0].Nelements != zvec[0].Nelements) {
+    gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[3]);
+    return (FALSE);
+  }
+  SetVector (&Zvec, OPIHI_FLT, zvec[0].Nelements);
+  out = Zvec.elements.Flt;
+ 
+  if (zvec[0].type == OPIHI_FLT) {
+    opihi_flt *in = zvec[0].elements.Flt;
+    for (i = 0; i < Zvec.Nelements; i++, in++, out++) {
+      *out = MIN (1.0, MAX (0.01, (*in - min) / range));
+    }
+  } else {
+    opihi_int *in = zvec[0].elements.Int;
+    for (i = 0; i < Zvec.Nelements; i++, in++, out++) {
+      *out = MIN (1.0, MAX (0.01, (*in - min) / range));
+    }
+  }
+
+  /* point size determined by Zvec */
+  graphmode.style = 2; /* plot points */
+  graphmode.color = -1; /* point color determined by Zvec */
+  graphmode.etype = 0; /* no errorbars */
+  PlotVectorTriplet (kapa, xvec, yvec, &Zvec, &graphmode);
+
+  free (Zvec.elements.Ptr);
+
+  return (TRUE);
+
+}
+
+
