From 598f19fbffa46494cb114e675e70c289b8e0c7bc Mon Sep 17 00:00:00 2001 From: Le Zhang Date: Mon, 15 Jun 2015 10:47:01 -0400 Subject: [PATCH] display simple legend so that it's easier to tell where each line is plotted from. For example: plot 'sin(x); 5*sin(x); 10*sin(x)' 0 2*pi --- plot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plot b/plot index 77f74a7..19be60b 100755 --- a/plot +++ b/plot @@ -40,7 +40,7 @@ for o, a in opts: # Handle the arguments. try: - fcns = args[0].split(';') + fcns = [x.strip() for x in args[0].split(';')] minx = eval(args[1]) maxx = eval(args[2]) except IndexError: @@ -60,6 +60,7 @@ x = linspace(minx, maxx, 100) for i, f in enumerate(fcns): y = eval(f) plt.plot(x, y, "-", linewidth=2) +plt.legend(fcns, frameon=False); plt.minorticks_on() plt.grid(which='both', color='#aaaaaa')