PGFPlot - Missing values in table data

I am using PGFPlot with external table data. However, some values are missing for some plots. This causes data in column 2 does not exists error. Is there a way to solve this. The value does not exists and all data for x, ind3 should be considered as {(1,7)(3,15)}. Is there a way to overcome this problem?

The following is the data file I tried to create:

x   ind2   ind3
1   5      7
2   9
3   11     15


And plot commands

\addplot[color=blue, mark=x] table[x=x, y=ind2] {performance.data};


• Are the entries in your datafile separated by tabs or by an unspecified number of spaces? – Jake Sep 18 '11 at 10:09
• @jake: they are tabs, but not single tabs. As much as needed to be pretty. – Cem Kalyoncu Sep 19 '11 at 7:03

As you noted yourself, using nan as a placeholder for empty values solves the problem. It's worth pointing out that you also have the choice of whether to just skip the empty value and connect the surrounding data points, or whether the graph should be interrupted when it encounters an empty value. You can control this behaviour using unbounded coords=skip (which is the default behaviour) or unbounded coords=jump.

\documentclass{article}
\usepackage{pgfplots}
\usepackage{filecontents}

\begin{filecontents}{performance.data}
x   ind2   ind3
0  2     4
1  5     7
2  9 nan
3 11  15
4 10  15
\end{filecontents}

\begin{document}
\begin{tikzpicture}
\begin{axis}[ymax=20]
\addplot +[unbounded coords=jump,yshift=0.5cm] table [y=ind3] {performance.data}; % Plot shifted upwards to show difference
\end{axis}
\end{tikzpicture}
\end{document}


using nan solves the problem

x   ind2   ind3
1   5      7
2   9      nan
3   11     15


This seems to work fine for me (with current version of TeXLive2011). If this does not solve your problem, please post a MWE.

\documentclass{article}
\usepackage{pgfplots}

\begin{filecontents}{performance.data}
x   ind2   ind3
1   5      7
2   9
3   11     15
\end{filecontents}

\begin{document}
\begin{tikzpicture}
\begin{axis}