I am trying to use pgfplots
to plot a linear regression to my data. If there is a nan
in my data set, no fit is generated, with the warning:
NOTE: coordinate (1,nan) has been dropped because it is unbounded (in y).
(see also unbounded coords=jump).
and similar warnings for the other points in the set.
If I set an ignore chars
and change the nan
to that character, compiling fails with the error:
! Package pgfplots Error: input table '<inline_table>' has an unbalanced number
of columns in row '2' (expected '2' cols; got '1'). Maybe the input table is c
orrupted? If you need unbalanced data, consider using 'nan' in empty cells (per
haps combined with 'unbounded coords=jump').
The following MWE reproduces this problem:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot table[x=X,y={create col/linear regression={y=Y}}]{
X Y
1 nan
2 1
3 2
4 3
};
\end{axis}
\end{tikzpicture}
\end{document}
How can I have nan
in my data set and still generate a fit, or how can I have an ignored character?