2
votes

It might be very simple, but I cannot find the specific answer to this: how can I plot the first vs the last and the second to last columns in several files whose column number is variable? is there something like

plot "mydata.txt" using 1:-1? 

I've already tried to use tail, but I don´t know hot to specifically use it, and couldn´t make this answer Count columns in csv in gnuplot work neither :(

Thanks!

1
Unfortunately I could not make this work, is there really not a reverse counting in gnuplot?madoro
No, there isn't. That's why I gave you this link. Why couldn't you make this work? On which OS are you working? Do you have any strings in your columns? etc.Christoph
Strings are commented, my data look like: #Time 11:36:56 11:37:56 11:38:56 11:39:56 11:40:56 11:41:56 11:42:56 PROMEDIO DESV_EST \n 11.5 1.79E+07 1.28E+07 1.14E+07 9.92E+06 1.31E+07 6.21E+06 1.22E+07 1.19E+07 3539969.182\n 15.4 3.12E+07 2.49E+07 2.08E+07 2.02E+07 2.28E+07 2.47E+07 2.31E+07 2.39E+07 3635170.737\n 20.5 2.98E+07 2.96E+07 2.75E+07 2.44E+07 3.10E+07 3.69E+07 2.73E+07 2.95E+07 3917515.953 But the total number of columns is variable in each file. I have to plot first column vs the two last ones... and I couldnt make your link work on these. Any idea why? (sorry data not formated)madoro
and I'm working in windows 8madoro

1 Answers

1
votes

An answer to Automatic series in gnuplot shows one possibility. But that doesn't work in Windows. In your special case, that all columns contain only numerical values (no time or strings), then you can use with gnuplot Version 5 the following:

stats 'mydata.txt' matrix nooutput
plot "mydata.txt" using 1:STATS_size_x

Beware, that the data you posted in a comment contains strange characters (U+200C ZERO WIDTH NON-JOINER and U+200B ZERO WIDTH SPACE) in the last column. I don't know if you also have them in your original data file, but that breaks your data.