0

Currently, I have a text file and I'm interested in plotting two different curves from a single file(values for x axis are the same-column 1, values for y axis-columns 3 and 4). The plot should be in STDOUT since I'm working from ssh. The file that I am working with looks like this (filename: tmp)

%Iter   duration    train_objective valid_objective difference
0   6.0 0.0195735   0.0610958   0.0415223
1   5.0 0.180216    0.191344    0.011128
2   5.0 0.223318    0.241081    0.017763
3   6.0 0.245895    0.262197    0.016302
4   6.0 0.25796 0.28056 0.0226
5   6.0 0.269223    0.291769    0.022546
6   5.0 0.281187    0.298474    0.017287
7   5.0 0.283891    0.305579    0.021688
8   5.0 0.296456    0.307381    0.010925
9   5.0 0.296856    0.315487    0.018631
10  5.0 0.295805    0.321391    0.025586
Total training time is 0:06:27

So far, I can only plot the values corresponding to the 3rd column using the following line:

cat tmp | gnuplot -e "set terminal dumb size 120, 30; set autoscale; plot '-' u 1:3 with lines notitle"

Could someone tell me then how I could include the 4th column in the same plot? is that possible? Thanks!

1 Answer 1

2

There is nothing in your description that rules out the trivial answer:

gnuplot -e "plot 'tmp' u 1:3 with lines, '' u 1:4 with lines"

The terminal choice is not relevant (you used 'set term dumb' but it could just as easily be any other output terminal, connection via ssh does not prevent that). If you have additional constraints that require a more complicated solution, please add them to the question.

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

2 Comments

The problem is that I would like to keep both curves in a single plot, but when I run the command you recommended I only got one curve instead of both at the same time
I assure you that is not the case. Plot elements separated by a comma are all placed in the same output graph. Note that your original command used '-' as an input source, which can only be read once. My suggested command instead used the file name directly so that it can be read multiple times.

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.