gnuplot - plot from a pipe/stdin

EDITED TO ADD: I have no idea how I missed this, you can just use "plot '-'" as mentioned in the comments. This proves that my searching skills suck.

This is not rocket science but I couldn't find it (yeah I know my searching foo sucks) on the Internet (aka Google nowadays).


So just to make a note if I would forget about this and I would want again to create plots from some data without putting it into file:

huge_one_liner_goes_here | gnuplot -p -e 'plot "< cat /proc/$$/fd/0"'

A small script I created that adds a bit more options can be found here.

A great page with examples is here. Two nice blogs, first one has been quiet since some time, the second one looks active.

3 comments:

  1. Anonymous5/4/13 15:21

    Why not just use plot '-' ?

    ReplyDelete
  2. I get errors when using multicolumn input from stdin with plot '-'

    ReplyDelete
    Replies
    1. AFAIK this happens because gnuplot rereads each column one by one, not by row/line. This will not work on a pipe, the data is gone after the first column was read.

      Delete