From: Chris K <gnu...@li...> - 2006-04-02 00:02:19
|
As I am trying to send data to gnuplot, I have been experimenting to understand how to pipe data to stdin. Short version: It is possible to put ascii data after a plot command with more than one blob (several sections that end with the line "e") Can I send more that one binary blob? In particular, I was seeing if I could send binary data via stdin: cat "command-1.gp" "binary.dat" | gnuplot where the command-1.gp file is one line: plot "-" binary record=5x2 using 1:2 with linespoints and the binary.dat file is 10 floats (40 bytes) That worked like I expected it to, parsing the binary file as "x1 y1 x2 y3 x3 y3 x4 y4 x5 y5" and plotting markers at (x1,y1) (x2,y2),... When I tried something more complicated, it failed: plot "-" binary record=5x2 using 1:2 with linespoints,\ "-" binary record=5x2 using 1:2 with linespoints cat "command-2.gp" "binary.dat" "binary.dat" | gnuplot The error message seems to indicated the second "-" is the problem: gnuplot> plot "-" binary record=5x2 using 1:($2) with linespoints, "-" binary record=5x2 using 1:($2)**2 with linespoints ^ line 0: warning: Skipping data file with no valid points The documentation page explains that: > General binary data can be entered at the command line via the special file name '-'. However, this is intended for use through a pipe where programs can exchange binary data, not for keyboards. There is no "end of record" character for binary data. Gnuplot continues reading from a pipe until it has read the number of points declared in the array qualifier. But I used a record qualifier. And I don't know how to simulate the array using records (even given that I can resort the order of the binary data). Both "array=5,5 index0" and "array=5,5 index 1" work like I expect. But I don't see how i can make an (x,y) plot from index 0 and index 1. Can gnuplot do the same ascii data tricks with binary data? |