Update copyright date; remove old CVS keyword
[ctsim.git] / libctgraphics / ezplot.cpp
index 099eff5ded8d050d0d067b225adfce18823b4429..cb4e0ece37358d9e6a15a0210936f18f9d787abc 100644 (file)
@@ -1,12 +1,10 @@
 /*****************************************************************************
 ** FILE IDENTIFICATION
 **
-**    EZPLOT
+**  ezplot.cpp
 **
 **  This is part of the CTSim program
-**  Copyright (c) 1983-2001 Kevin Rosenberg
-**
-**  $Id$
+**  Copyright (c) 1983-2009 Kevin Rosenberg
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -1161,10 +1159,19 @@ EZPlot::symbol (int sym, double symwidth, double symheight)
 int
 EZPlot::axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp)
 {
-  if (min >= max || nint < 1) {
-    sys_error (ERR_WARNING, "Invalid params: min=%lf, max=%lf, num intervals=%d [axis_scale]", min, max, nint);
+  if (nint < 1) {
+    sys_error (ERR_WARNING, "No intervals to plot: num intervals=%d [axis_scale]", nint);
     return (FALSE);
   }
+  if (min >= max) {
+    double scaled = fabs(max) / 10;
+    if (scaled == 0)
+      scaled = 0.1;
+    *minp = min - scaled;
+    *maxp = max + scaled;
+    *nintp = 2;
+    return (TRUE);
+  }
 
   double eps = 0.025;
   double a = fabs(min);