I don’t actually get much chance to use gnuplot, but it can plot data from a pipe. The syntax is a bit more involved as I recall.
gnuplot> plot '<pipeline'
It just uses system(3) for "pipeline". So, technically you could have a whole script in there with maybe tricky gnuplot-quoting/escaping of shell stuff.You do have 2 different history logs this way - the shell one and the plot one while the uplot way is integrated.
If you really want integrated, you could drive gnuplot with temp files, though each shell command-line would probably have to pass a lot of controls. E.g.,
#!/bin/sh
cat > /tmp/dat # should use mktemp -d
cat > /tmp/p.gpi <<-EOF
plot '/tmp/dat' $*
EOF
gnuplot /tmp/p.gpi
and then $ seq 1 10 | gpl with lines
It is an exercise for the reader (well, it has probably been done N times...) to harden the temp paths, clean up afterward, generalize to source user/maybe per-directory `foo.gpi` setup and so on.In the unlikely event temp space is actually any sort of issue then you might be able to use mkfifo (I've never tried) or else generate a .gpi script that uses the plot '<string' syntax escaping `string`.
seq 1 10 | gnuplot -e "plot '<cat' with lines"
[1] https://news.ycombinator.com/item?id=34365290 gnuplot -e "set terminal sixelgd;plot '<&3' with lines" 3< <(seq 1 10)
Good luck remembering that! seq 1 10 | gnuplot -e 'plot "-"'