TSVPlot added

This commit is contained in:
ville rantanen
2014-06-13 16:56:34 +03:00
parent e891317044
commit 3bc092e66a
4 changed files with 32 additions and 2 deletions

View File

@@ -1 +1 @@
../tsvedit.py ../tsv/tsvedit.py

1
bin/tsvplot Symbolic link
View File

@@ -0,0 +1 @@
../tsv/tsvplot

View File

@@ -229,7 +229,7 @@ if not os.path.exists(opts.tsv):
# Convert CSV -> SC # Convert CSV -> SC
f_sc_w=open(f_sc,'wt') 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, csv_reader = csv.reader(f_csv_r,
delimiter=opts.delimiter, delimiter=opts.delimiter,
doublequote=False, doublequote=False,

29
tsv/tsvplot Executable file
View File

@@ -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 '<cat' using 1:2 title '$1 $3' $4"
[[ $? -ne 0 ]] && {
echo -n "Possible columns: "
head -n 1 "$1" | tr \\t ,
}