I need to plot data files which contain a comment in the last line, like this:
0 2 4
1 5 7
2 9 5
3 11 15
4 10 15
THIS WAS: TOTAL
Now, pgfplots seems to have a problem with that giving me an error message complaining about an unbalanced number of columns.
My question is: How do I tell pgfplots to ignore the last row of the data file? (I know about the skip first option of pgfplotstable. Maybe there is an equivalent for the last row that I just couldn't find in the manual.)
MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable} % For \pgfplotstableread
\usepackage{filecontents}
\begin{filecontents}{total.dos}
0 2 4
1 5 7
2 9 5
3 11 15
4 10 15
THIS WAS: TOTAL
\end{filecontents}
\pgfplotstableread{total.dos}\total
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot [no markers, red] table [x=0, y=1] {\total}; \addlegendentry{$1$}
\addplot [no markers, blue] table [x=0, y=2] {\total}; \addlegendentry{$2$}
\end{axis}
\end{tikzpicture}
\end{document}
