From 9d5d73f2ab7e321616f7cf353bde1a73a60d9233 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 1 Aug 2011 18:37:55 +0200 Subject: [PATCH] Cleanups in gnuplot setup --- git-chart | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/git-chart b/git-chart index 3b8cbdf..6b8900b 100755 --- a/git-chart +++ b/git-chart @@ -248,7 +248,9 @@ sub gnuplot_chart($;$) { # in particular, detect (lack of) display and set term to dumb accordingly my $termcmd = $options->{gnuplot_term}; - my $plotsetup = $options->{gnuplot_setup} || 'set nokey'; + my $plotsetup = $options->{gnuplot_setup} || + @authors == 1 ? 'set nokey' : + 'set key outside autotitle columnheader' ; $plotsetup .= "\nset yrange [0:$max]\n"; $plotsetup .= "set xrange ['$from':'$to']\n"; my ($formatx, $ticks); @@ -279,13 +281,10 @@ sub gnuplot_chart($;$) { open my $gp, "|gnuplot -persist"; - my $plotcmd; - if (@authors == 1) { - $plotcmd = "plot '$datafile' using 1:3"; - } else { + my $plotcmd = "plot '$datafile' using 1:2"; + if (@authors > 1) { my $lastcolumn = $#authors + 3; - $plotsetup .= "set key outside autotitle columnheader\n"; - $plotcmd = "plot '$datafile' using 1:2 notitle"; + $plotcmd.= " notitle"; $plotcmd.= ", for [a=3:$lastcolumn] '' using 1:a"; } -- 2.32.0.93.g670b81a890