TSVPlot added
This commit is contained in:
29
tsv/tsvplot
Executable file
29
tsv/tsvplot
Executable 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 ,
|
||||
}
|
||||
Reference in New Issue
Block a user