From 05494b814fd1eb6f3ff0d3248eac0a1e7b59a624 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 10 Mar 2008 16:30:42 -0400
Subject: [PATCH] Visual improvements in logtool.

---
 bin/logtool | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/bin/logtool b/bin/logtool
index 428ee37..4d9b2f0 100755
--- a/bin/logtool
+++ b/bin/logtool
@@ -55,6 +55,14 @@ following:
 
     legend_prefix = ""
 
+    from pytools import cartesian_product, Record
+    styles = [
+            Record(dashes=dashes, color=color)
+            for dashes, color in cartesian_product(
+                [(), (2, 2), (6, 2), (1,1) ],
+                ["blue", "green", "red", "magenta", "cyan"],
+                )]
+
     def check_no_file():
         if logmgr is None:
             raise RuntimeError, "no file loaded"
@@ -117,7 +125,9 @@ following:
             if options.legend_descr:
                 kwargs["label"] = legend_prefix+descr_y
 
-            plot(data_x, data_y, hold=True, **kwargs)
+            style = styles.pop(0)
+            plot(data_x, data_y, dashes=style.dashes, color=style.color, 
+                    hold=True,  **kwargs)
 
             did_plot = True
         elif cmd == "datafile":
@@ -143,7 +153,8 @@ following:
     if did_plot:
         from pylab import show, title, legend, axis, grid
         if options.legend_expr or options.legend_descr:
-            legend()
+            from matplotlib.font_manager import FontProperties
+            legend(pad=0.04, prop=FontProperties(size=7), loc="best")
 
         def float_or_none(str):
             if str == "*":
-- 
GitLab