From 57ebc87e074decd2f840b7173675bcf05202cf95 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 15 Jan 2008 11:27:15 -0500
Subject: [PATCH] User-defined scaling in logtool.

---
 bin/logtool | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/bin/logtool b/bin/logtool
index 7b66471..2eb810b 100755
--- a/bin/logtool
+++ b/bin/logtool
@@ -16,11 +16,15 @@ following:
     parser = OptionParser(usage="%prog FILE COMMANDS FILE COMMANDS...",
             description=description)
 
+    parser.add_option("--scale-x", metavar="XMIN,XMAX",
+            help="Set the scale of the X axis")
+    parser.add_option("--scale-y", metavar="YMIN,YMAX",
+            help="Set the scale of the Y axis")
     parser.add_option("--units-x", 
-            help="No description on the X axis",
+            help="Show only units, not descriptions on the X axis",
             action="store_true")
     parser.add_option("--units-y", 
-            help="No description on the Y axis",
+            help="Show only units, not descriptions on the Y axis",
             action="store_true")
     parser.add_option("--legend-expr", 
             help="Generate a legend from the expression",
@@ -102,10 +106,17 @@ following:
             logmgr.load(cmd)
 
     if did_plot:
-        from pylab import show, title, legend
+        from pylab import show, title, legend, axis
         if options.legend_expr or options.legend_descr:
             legend()
 
+        xmin, xmax, ymin, ymax = axis()
+        if options.scale_x:
+            xmin, xmax = [float(x) for x in options.scale_x.split(",")]
+        if options.scale_y:
+            ymin, ymax = [float(x) for x in options.scale_y.split(",")]
+        axis((xmin, xmax, ymin, ymax))
+
         title(options.title)
         show()
 
-- 
GitLab