5

The following MWE:

\documentclass{standalone}

\usepackage{tikz}
\usepackage{pgfplots}

\usetikzlibrary{pgfplots.statistics}

\pgfplotsset{compat=1.9}

\begin{document}

    \begin{tikzpicture}
      \begin{axis}
        \addplot+[boxplot] table[row sep=\\,y index=0] {
          data\\
          1\\ 2\\ 1\\ 5\\ 4\\ 10\\ 9\\
        };
        \addplot+[boxplot] table[row sep=\\,y index=0] {
          data\\
          1\\ 2\\ 1\\ 5\\ 4\\ 10\\
        };

     \end{axis}
   \end{tikzpicture}

\end{document}

results in th folllowing error whn compiled with pdflatex:

! Package PGF Math Error: Sorry, an internal routine of the floating point unit
 got an ill-formatted floating point number `'. The unreadable part was near ''
..

See the PGF Math package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.25         };

Where am I wrong and why the second example causes this error ?

  • Looks like a bug/feature/necessity to me. It doesn't work with even sample numbers if the total is less than or equal to six. Probably some data is discarded during the computations and too few samples make the data array emptied. – percusse Feb 12 '15 at 12:53
  • @percusse Thanks. Did you saw that in any documentation, or guessed it by trying on examples ? – Manuel Selva Feb 12 '15 at 13:01
  • Just a lucky(or not) guess. – percusse Feb 12 '15 at 13:03
  • This erratic behaviour leads me to think that I should compute myself the statistics values and use a prepared box plot. – Manuel Selva Feb 12 '15 at 14:06
  • I wouldn't say erratic because that sample size is very few for any kind of statistical inference. I would consider it as a borderline case. The rest works pretty good. Probably @Jake can explain better. – percusse Feb 12 '15 at 14:44
4

Please upgrade to pgfplots 1.12 . It improves the boxplot quality significantly, especially if you write \pgfplotsset{compat=1.12} (in which case it will use standardized value estimators). Aside from the general improvements, it also comes with a bugfix for this issue.

  • Thanks for the answer. Unfortunately I am not sure the Ubuntu packaged version already include pgfplots 1.12. I'll look at that. – Manuel Selva Feb 14 '15 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.