pgfplots can deal with missing values in table inputs by either skipping or jumping over any values which are given as nan in the input table file, as discussed here. I want to do a similar thing with error bar plots. In particular, several entries of the table column where errors are given are set to nan, as in the code example below. I'd like to have a result where error bars are only plotted on points where non-nan values are available.
\documentclass[11pt]{article}
\usepackage{pgfplots}
\begin{filecontents}{tabletest.data}
x ind2 ind3
0 0.22507 0.99741
1 0.22507 nan
2 0.22507 0.99741
3 0.22507 nan
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xlabel=x,ylabel=y,no markers]
\addplot plot[error bars/.cd,y dir=plus,y explicit,error mark=diamond*]
table[x=x,y=ind2,y error=ind3] {tabletest.data};
\end{axis}
\end{tikzpicture}
\end{document}
Unfortunately, compilation fails with the errors Missing number, treated as zero. and Illegal unit of measure (pt inserted). When replacing nan by numeric values, the file compiles, but of course has error bars on all points.
Is there another reasonably way to get error bars only on part of the plotted points from table data, or is this a missing feature in pgfplots?
This question has an answer suggesting the use of gnuplot, but I'd like to do it without gnuplot.
coordinateslist, so PGFplots definitely has the capability to omit error bars for some values, it just doesn't parse thetabledata correctly in this case. You might want to open a feature request at the Sourceforge site – Jake Jun 27 '12 at 11:59filecontentsenvironment should be used. But still I couldn't make it work. – percusse Jun 27 '12 at 12:03filecontentsenvironment don't do any harm (lines starting with#or%are ignored). – Jake Jun 27 '12 at 12:07