2

I'm having some problems trying to plot two different data sets from stdin in gnuplot... This is the command I'm testing with:

% gnuplot -persist <<EOF            
plot '-' index 0 with points, \
'' index 1 with points
1 1.2
2 1.8
3 1.6


1.1 0.8
2.1 0.3
3.1 1.0
EOF

Any advise will be very helpful. Thanks

2 Answers 2

6

I think this should help you

It’s even possible to read data from standard input multiple times within the same plot command:

plot '-', '-' 

will read data until an end-of-file character is encoun tered and then expect to read more data (for the second “file”) until finding a second EOF character. Of course, the data entered at a prompt this way can have multiple col umns, from which we can select some with using, and all the other features of the plot command can be used as well.

(from: Philipp K. Janert, Gnuplot In Action)

Sign up to request clarification or add additional context in comments.

3 Comments

I didn't know this. Thanks. This really works: echo $'1\n2\n3\ne\n4\n5\n6' | gnuplot -p -e 'plot "-" with lines,"-" with lines'
That worked smoothly, this is my final command: % gnuplot -persist <<EOF plot '-' with points, \ '-' with points 1 1.2 2 1.8 3 1.6 e 1.1 0.8 2.1 0.3 3.1 1.0 EOF Thank you much for your help!
@Cacaroto Vega: Happy that I could help! - Pls mark answered.
1

Gnuplot probably wants to reread the input for the second index keyword, but stdin is not seekable. Create a temporary input file.

1 Comment

Due to disk space limitations, I'd prefer to read from stdin. Do you have another suggestion. Thanks for the quick response..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.