Index: /trunk/psModules/src/extras/pmKapaPlots.c
===================================================================
--- /trunk/psModules/src/extras/pmKapaPlots.c	(revision 10865)
+++ /trunk/psModules/src/extras/pmKapaPlots.c	(revision 10866)
@@ -7,6 +7,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-12-29 18:29:12 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-01-01 21:03:41 $
  *
  *  Copyright 2006 Institute for Astronomy, University of Hawaii
@@ -22,12 +22,12 @@
 // the top portion of this file defines plotting functions which use kapa for plotting.
 // if kapa is not available, these functions are defined in the bottom portion as stubs
-// which perform NOP and return false (XXX should this be true??)
+// which perform NOP and return false (XXX should this be 'true' ??)
 
 # if (HAVE_KAPA)
-    # include <kapa.h>
 
     // XXX not thread safe (perhaps not needed)
     // to make this thread safe, we could check the thread ID and tie to it
     static int kapa_fd = -1;
+
 int pmKapaOpen (bool showWindow)
 {
@@ -56,4 +56,39 @@
 }
 
+bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec)
+{
+
+    // set limits based on data values
+    graphdata->xmin = FLT_MAX;
+    graphdata->xmax = FLT_MIN;
+    graphdata->ymin = FLT_MAX;
+    graphdata->ymax = FLT_MIN;
+    for (int i = 0; i < xVec->n; i++) {
+        graphdata->xmin = PS_MIN (graphdata->xmin, xVec->data.F32[i]);
+        graphdata->xmax = PS_MAX (graphdata->xmax, xVec->data.F32[i]);
+        graphdata->ymin = PS_MIN (graphdata->ymin, yVec->data.F32[i]);
+        graphdata->ymax = PS_MAX (graphdata->ymax, yVec->data.F32[i]);
+    }
+    // add 5% to range
+    float range;
+
+    range = graphdata->xmax - graphdata->xmin;
+    graphdata->xmax += 0.05*range;
+    graphdata->xmin -= 0.05*range;
+
+    range = graphdata->ymax - graphdata->ymin;
+    graphdata->ymax += 0.05*range;
+    graphdata->ymin -= 0.05*range;
+
+    KapaSetLimits (kapa, graphdata);
+    KapaSetFont (kapa, "helvetica", 14);
+    KapaBox (kapa, graphdata);
+
+    KapaPrepPlot (kapa, xVec->n, graphdata);
+    KapaPlotVector (kapa, xVec->n, xVec->data.F32);
+    KapaPlotVector (kapa, yVec->n, yVec->data.F32);
+    return true;
+}
+
 bool pmKapaPlotVectorPair (psVector *xVec, psVector *yVec)
 {
@@ -71,5 +106,5 @@
 
     KapaInitGraph (&graphdata);
-    KapaClear (kapa, FALSE);
+    KapaClear (kapa, TRUE);
 
     // set limits based on data values
@@ -111,4 +146,5 @@
 
 # else
+    # include "pmKapaPlots.h"
 
     int pmKapaOpen ()
@@ -127,3 +163,8 @@
 }
 
+bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, void *graphdata, psVector *xVec, psVector *yVec)
+{
+    return false;
+}
+
 # endif
Index: /trunk/psModules/src/extras/pmKapaPlots.h
===================================================================
--- /trunk/psModules/src/extras/pmKapaPlots.h	(revision 10865)
+++ /trunk/psModules/src/extras/pmKapaPlots.h	(revision 10866)
@@ -7,6 +7,6 @@
 *  @author EAM, IfA
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-12-29 18:29:12 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-01-01 21:03:41 $
 *
 *  Copyright 2006 Institute for Astronomy, University of Hawaii
@@ -21,3 +21,13 @@
 bool pmKapaPlotVectorPair (psVector *xVec, psVector *yVec);
 
+# if (HAVE_KAPA)
+    # include <kapa.h>
+
+    // yes, this is an absurd name...
+    bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec);
+# else
+
+    bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, void *graphdata, psVector *xVec, psVector *yVec);
+# endif
+
 #endif // PM_KAPA_PLOTS_H
