I have data file of the form:
unimportant1 unimportant2 unimportant3 matrixdata[i] 1e4 2e5 3e2 1 2 3 4 5 2e3 1e1 7e3 5 4 3 2 1 ... ... ... ... 2e3 1e4 4e2 4 4 4 4 4
So it has columnheaders (here "unimportant1" to "unimportant3") as the first row. I want gnuplot to ignore these first three unimportant columns columns so the data entries in exponential notation. I want gnuplot to plot the matrixdata as a matrix. So as if I did it like this:
#!/usr/bin/gnuplot -p
plot '-' matrix with image
1 2 3 4 5
5 4 3 2 1
...
4 4 4 4 4
e
How do I get gnuplot to ignore the first three columns and the header row and plot the rest as matrix image? For compatibility, I would prefere a gnuplot built-in to do that, but I could write a shell script and use the `plot '< ...' syntax preprocessing the data file.
Edit: So neuhaus' answer almost solved it. The only thing I'm missing is, how to ignore the first row (line) with the text header data. Every seems to expect numeric data and so the whole plot fails as it's not a matrix. I don't want to comment out the fist line, as I'm using the unimportant data sets for other 2D plots that, in turn, use the header data.
So how do I skip a row in a matrix plot that already uses every
to skip columns?
skip
option, which unfortunately works only withoutmatrix
:plot 'data.dat' skip 1 with lines
. But I would consider this a bug, for meplot 'matrix.dat' matrix every ::3 skip 1 with image
should work... A very ugly and fragile hack would be to useset datafile commentschar 'u'; plot 'matrix.dat' matrix every ::3 with image
. – Christoph#
would make things very much simpler. – Joce