Files
q-tools/tsv/tsvplot
ville rantanen 3bc092e66a TSVPlot added
2014-06-13 16:56:34 +03:00

30 lines
651 B
Bash
Executable File

#!/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 ,
}