I would like to plot a column of data output by a script in unix in just one line. For example, something like
script | cut -f2 -d ',' | gnuplot ....
You have to give gnuplot
a plotting instruction in the command line, and can use the data piping special file '-'
.
E.g.,
echo "1\n2\n4\n8\n16" | gnuplot -e "plot '-' u 0:1 w linespoints" -persist
The -persist
option allows to keep the window open. If you want to produce a PDF rather, you can use:
echo "1\n2\n4\n8\n16" | gnuplot -e "set term pdf; set output 'plot.pdf'; plot '-' u 0:1 w linespoints"