From 3bc092e66a9fc2133357ff1fd63aa99a7659f5b7 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Fri, 13 Jun 2014 16:56:34 +0300 Subject: [PATCH] TSVPlot added --- bin/tsvedit | 2 +- bin/tsvplot | 1 + tsvedit.py => tsv/tsvedit.py | 2 +- tsv/tsvplot | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 120000 bin/tsvplot rename tsvedit.py => tsv/tsvedit.py (99%) create mode 100755 tsv/tsvplot diff --git a/bin/tsvedit b/bin/tsvedit index 1c0b6fb..e99c5fa 120000 --- a/bin/tsvedit +++ b/bin/tsvedit @@ -1 +1 @@ -../tsvedit.py \ No newline at end of file +../tsv/tsvedit.py \ No newline at end of file diff --git a/bin/tsvplot b/bin/tsvplot new file mode 120000 index 0000000..6e32376 --- /dev/null +++ b/bin/tsvplot @@ -0,0 +1 @@ +../tsv/tsvplot \ No newline at end of file diff --git a/tsvedit.py b/tsv/tsvedit.py similarity index 99% rename from tsvedit.py rename to tsv/tsvedit.py index 93b3e5c..cfced7a 100755 --- a/tsvedit.py +++ b/tsv/tsvedit.py @@ -229,7 +229,7 @@ if not os.path.exists(opts.tsv): # Convert CSV -> SC f_sc_w=open(f_sc,'wt') -f_csv_r=open(opts.csv,'rt') +f_csv_r=open(opts.tsv,'rt') csv_reader = csv.reader(f_csv_r, delimiter=opts.delimiter, doublequote=False, diff --git a/tsv/tsvplot b/tsv/tsvplot new file mode 100755 index 0000000..14ed596 --- /dev/null +++ b/tsv/tsvplot @@ -0,0 +1,29 @@ +#!/bin/bash + +[[ -z "$3" ]] && { + echo "Plot2D for console. + + Arguments + tsvplot FILE xCol yCol [plotStyle] [preBlock] + + e.g. tsvplot cal.tsv 2 4 + or tsvplot cal.tsv Area Weight \"with lines;\" \"set title 'test plot';\" + preBlock may contain any GNUPlot commands. + plotStyle contains any plotting style commands. + + Requires csvkit and gnuplot + " + exit +} + +csvcut -t -c "$2,$3" "$1" | gnuplot -e " +set term dumb $(tput cols) $(tput lines) enhanced; +set datafile separator \",\"; +set xlabel '$2'; +$5 +plot '